Export (0) Print
Expand All

HttpWebRequest.RequestUri Property

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

Namespace:  System.Net
Assemblies:   System.Net.Requests (in System.Net.Requests.dll)
  System (in System.dll)

public override Uri RequestUri { get; }

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.

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 != req.Address);
 

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1

Supported in: Windows Phone Silverlight 8.1

Supported in: Windows Phone Silverlight 8
Show:
© 2015 Microsoft