Export (0) Print
Expand All

HttpRequest.Url Property

Gets Information about the URL of the current request.

[Visual Basic]
Public ReadOnly Property Url As Uri
[C#]
public Uri Url {get;}
[C++]
public: __property Uri* get_Url();
[JScript]
public function get Url() : Uri;

Property Value

A Uri object containing information regarding the URL of the current request.

Example

The following example assigns the Uri object of the current request to an object variable and writes two properties of the URL object to the HTTP output.

[Visual Basic] 
Dim MyUrl As Uri = Request.Url
 Response.Write("URL Port: " & MyUrl.Port & "<br>")
 Response.Write("URL Protocol: " & Server.HtmlEncode(MyUrl.Scheme) & "<br>")


[C#] 
Uri MyUrl = Request.Url;
 Response.Write("URL Port: " + MyUrl.Port + "<br>");
 Response.Write("URL Protocol: " + Server.HtmlEncode(MyUrl.Scheme) + "<br>");


[C++] 
Uri* MyUrl = Request->Url;
 Response->Write(String::Format(S"URL Port: {0}<br>", __box(MyUrl->Port)));
 Response->Write(String::Format(S"URL Protocol: {0}<br>", Server->HtmlEncode(MyUrl->Scheme)));


[JScript] 
var myUrl : Uri = Request.Url
Response.Write("URL Port: " + myUrl.Port + "<br>")
Response.Write("URL Protocol: " + Server.HtmlEncode(myUrl.Scheme) + "<br>")

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

See Also

HttpRequest Class | HttpRequest Members | System.Web Namespace

Show:
© 2014 Microsoft