HttpWebResponse.ResponseUri Property


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Gets the URI of the Internet resource that responded to the request.

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

public override Uri ResponseUri { get; }

Property Value

Type: System.Uri

A Uri that contains the URI of the Internet resource that responded to the request.

Exception Condition

The current instance has been disposed.

The ResponseUri property contains the URI of the Internet resource that actually responded to the request. This URI might not be the same as the originally requested URI, if the original server redirected the request.

The ResponseUri property will use the Content-Location header if present.

Applications that need to access the last redirected ResponseUri should use the HttpWebRequest.Address property rather than ResponseUri, since the use of ResponseUri property may open security vulnerabilities.

This example creates a HttpWebRequest and queries for an HttpWebResponse and then checks to see whether the original URI was redirected by the server.

Uri myUri = new Uri(url);
// Create a 'HttpWebRequest' object for the specified url. 
HttpWebRequest myHttpWebRequest = (HttpWebRequest)WebRequest.Create(myUri); 
// Send the request and wait for response.
HttpWebResponse myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse(); 
if (myHttpWebResponse.StatusCode == HttpStatusCode.OK)
             Console.WriteLine("\nRequest succeeded and the requested information is in the response ,Description : {0}",
if (myUri.Equals(myHttpWebResponse.ResponseUri))
	Console.WriteLine("\nThe Request Uri was not redirected by the server");
	Console.WriteLine("\nThe Request Uri was redirected to :{0}",myHttpWebResponse.ResponseUri);
// Release resources of response object.

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