Gets the URI of the Internet resource that actually responded to the request.
using System;
using System.Net;
class MainClass
{
public static void Main()
{
Uri url = new Uri("http://google.com");
WebRequest myWebRequest = WebRequest.Create(url);
WebResponse myWebResponse = myWebRequest.GetResponse();
if (url.Equals(myWebResponse.ResponseUri))
Console.WriteLine("\nRequest Url : {0} was not redirected", url);
else
Console.WriteLine("\nRequest Url : {0} was redirected to {1}", url, myWebResponse.ResponseUri);
myWebResponse.Close();
}
}
Related examples in the same category