Hi
In .Net 2.0 how can I disallow AutoRedirect when using WebRequest? I found some source code were there where used an AllowAutoRedirect property, but on my WebRequest there is no such property.
Hi
In .Net 2.0 how can I disallow AutoRedirect when using WebRequest? I found some source code were there where used an AllowAutoRedirect property, but on my WebRequest there is no such property.
You need to cast it to a HttpWebRequest
HttpWebRequest WebRequest =
(HttpWebRequest)System.Net.WebRequest.Create("http://www.mySite.com");
WebRequest.AllowAutoRedirect = false;
WebRequest
itself doesn't have such a property, but HttpWebRequest
does. If you cast to HttpWebRequest
, you can set AllowAutoRedirect
to false.
If your web request really isn't an HttpWebRequest
, please explain what kind of request it is.