"too many automatic redirections were attempted" error message when using a httpWebRequest in .NET

Posted by tooleb on Stack Overflow See other posts from Stack Overflow or by tooleb
Published on 2009-02-05T22:04:45Z Indexed on 2012/11/01 11:01 UTC
Read the original article Hit count: 1934

Filed under:
|
|
|

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 requests. I have gotten past the authentication part by adding my credentials. But once that works it seems to go into a redirecting loop.

Does anyone have an ideas, comments, suggetions why this is? Has anyone else experienced this problem?

Dim loHttp As HttpWebRequest =  CType(WebRequest.Create(_url), HttpWebRequest)
loHttp.Timeout = 10000
loHttp.Method = "GET"
loHttp.KeepAlive = True
loHttp.AllowAutoRedirect = True
loHttp.PreAuthenticate = True
Dim _cred1 As NetworkCredential = ... //this is setup
//snip out this stuff
loHttp.Credentials = _cc
loWebResponse = loHttp.GetResponse()

© Stack Overflow or respective owner

Related posts about .NET

Related posts about vb.net