I am attempting to request a page like \"http://www.google.com/?q=random\" using the webrequest class in vb.net. we are behind a firewall, so we have to authenticate our req
I translated the C# that Darryl provided to VB and inserted it before the getResponse call.
Dim cookieContainer As CookieContainer = New CookieContainer()
loHttp.CookieContainer = cookieContainer
loWebResponse = loHttp.GetResponse()
loHttp.AllowAutoRedirect = true
Instead of this, you have to use
loHttp.AllowAutoRedirect = False
to avoid error the error
"TOO MANY AUTOMATIC REDIRECTION WERE ATTEMPTED"
Make sure you have a cookie container setup.
CookieContainer cookieContainer = new CookieContainer();
loHttp.CookieContainer = cookieContainer;
You are probably not saving cookies and getting caught in a redirect loop.
Maybe, you can individually process for each redirection by catch up Location from response and use suitable cookies.