HTTPWebRequest and 302 redirection

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Sorry for the multipost but I need immediate solution to my problem:

I am trying to access an ASP.NET web site programmatically. I use
HttpWebRequest and HttpWebResponse classes. Everything goes well until I come
to a page that sends me a 302 Found response. I need to get Location header
from the response but it seems that HttpWebRequest only gets 200 OK. How can
I access to 302 Found response?

Thanks in advance...
 
by default webclient does the redirect, so the 200 ok is from the redirected
page. if you want to handle redirects yourself, set AllowAutoRedirect to
false.

-- bruce (sqlwork.com)
 
Back
Top