This documentation is archived and is not being maintained.

HttpWebRequest.RequestUri Property

Gets the original URI of the request.

[Visual Basic]
Overrides Public ReadOnly Property RequestUri As Uri
public override Uri RequestUri {get;}
public: __property Uri* get_RequestUri();
public override function get RequestUri() : Uri;

Property Value

A Uri containing the URI of the Internet resource passed to the WebRequest.Create method.


The Uri instance passed to HttpWebRequest by the call to WebRequest.Create.

Following a redirection header does not change the RequestUri property. To get the actual URI that responded to the request, examine the Address property.


The following example checks to see if the HttpWebRequest instance req was redirected to another location to fulfill the request, and sets the value of the hasChanged variable to true if the request was redirected; otherwise hasChanged is set to false.

[Visual Basic] 
Dim hasChanged As Boolean = _
   (req.RequestUri.ToString() <> req.Address.ToString())

bool hasChanged = (req.RequestUri != req.Address);

bool hasChanged = req->RequestUri->Equals(req->Address);

var hasChanged : Boolean = (req.RequestUri.ToString() != req.Address.ToString())


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

See Also

HttpWebRequest Class | HttpWebRequest Members | System.Net Namespace