Export (0) Print
Expand All

UriBuilder.Fragment Property

Gets or sets the fragment portion of the URI.

[Visual Basic]
Public Property Fragment As String
[C#]
public string Fragment {get; set;}
[C++]
public: __property String* get_Fragment();
public: __property void set_Fragment(String*);
[JScript]
public function get Fragment() : String;
public function set Fragment(String);

Property Value

The fragment portion of the URI. The fragment identifier ("#") is added to the beginning of the fragment.

Remarks

The Fragment property contains any text following a fragment marker (#) in the URI, including the marker itself. When setting the Fragment property, the fragment marker is added to its value. Setting the Fragment property to any value, including a null reference (Nothing in Visual Basic), clears the Query property. Setting the Fragment property to a null reference (Nothing) or to String.Empty clears the property.

Example

[Visual Basic, C#, C++] The following example creates the URI "http://www.contoso.com/index.htm#main".

[Visual Basic] 
Dim uBuild As New UriBuilder("http://www.contoso.com/")
uBuild.Path = "index.htm"
uBuild.Fragment = "main"
        
Dim myUri As Uri = uBuild.Uri


[C#] 
UriBuilder uBuild = new UriBuilder("http://www.contoso.com/");
uBuild.Path = "index.htm";
uBuild.Fragment = "main";

Uri myUri = uBuild.Uri;
   

[C++] 
UriBuilder* uBuild = new UriBuilder(S"http://www.contoso.com/");
uBuild->Path = S"index.htm";
uBuild->Fragment = S"main";

Uri* myUri = uBuild->Uri;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Common Language Infrastructure (CLI) Standard

See Also

UriBuilder Class | UriBuilder Members | System Namespace

Show:
© 2014 Microsoft