Initializes a new WebRequest instance for the specified URI scheme.
using System;
using System.Net;
using System.IO;
using System.Text;
using System.Threading;
public 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