System.Net.WebClient and redirection

  • Thread starter Thread starter buu
  • Start date Start date
B

buu

I'm grabbing web page using WebClient, and I would like to know if that page
has a redirection...
how could I know that?
is there any dinamyc property in WebClient?
 
Hello, buu!

WebClient class instance has AllowAutoRedirect set true. So it has to
automatically follow redirection responses.

--
With best regards, Vadym Stetsiak.
Blog: http://vadmyst.blogspot.com

You wrote on Thu, 17 Jan 2008 23:19:36 +0100:

b> I'm grabbing web page using WebClient, and I would like to know if
b> that page has a redirection...
b> how could I know that?
b> is there any dinamyc property in WebClient?
 
Hello, buu!

When using HttpWebRequest it automatically handles redirects, unless you
disable it with the AllowAutoRedirect=false

When disabled you'll get the page with redirect information and will have to
make redirection manually.
In this case HTTP status code returned will be 301.

New location of a resource will be specified under header "Location"
--
With best regards, Vadym Stetsiak.
Blog: http://vadmyst.blogspot.com

You wrote on Fri, 18 Jan 2008 23:38:54 +0100:

b> Is it better to use WebRequest?
b> is it is... why? or why not?
 
Back
Top