Why the location is not listed on the response Headers?
My code:
string url = "http://hehe.freevar.com/files.php";
HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(url);
req.Method = "HEAD";
Console.WriteLine(req.GetResponse().Headers);
From Wikipedia:
The
HttpWebRequestclass has a propertyAllowAutoRedirectwhich defaults to true:This means you will never see the redirect request unless you set
AllowAutoRedirectto false before making the request:Then you get the following response which does include Location: