Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
RequestUri Property

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

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone Silverlight 8.1, Windows Phone Silverlight 8

Portable Class Library

Supported in: Portable Class Library
Show:
© 2015 Microsoft