RequestUri Property

HttpWebRequest::RequestUri Property


Gets the original Uniform Resource Identifier (URI) of the request.

Namespace:   System.Net
Assembly:  System (in System.dll)

property Uri^ RequestUri {
	virtual Uri^ get() override;

Property Value

Type: System::Uri^

A Uri that contains the URI of the Internet resource passed to the WebRequest::Create method.

The Uri object 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.

Legacy Code Example

The following code example checks to see if the HttpWebRequest object 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.

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

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
© 2015 Microsoft