Bypass Forbidden and Server Internal Error with httpwebrequest

Posted by Burnzy on Stack Overflow See other posts from Stack Overflow or by Burnzy
Published on 2010-06-10T20:31:19Z Indexed on 2010/06/10 20:32 UTC
Read the original article Hit count: 345

Filed under:
|

i'm a getting forbidden (403) and Server Internal Error(500) when doing a request to a site even if when trying it with the browser, everything is fine. Here's my code and my appdata tag concerning httpwebrequest

HttpWebRequest request = (HttpWebRequest)WebRequest.Create( uri );

request.Method = "HEAD"; request.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/4.0)"; request.AllowAutoRedirect = true; request.SendChunked = true; request.UnsafeAuthenticatedConnectionSharing = true; request.KeepAlive = false; request.Timeout = 7500; using( HttpWebResponse response = (HttpWebResponse)request.GetResponse() ) { request.Abort(); }

app settings:

Thank you!

© Stack Overflow or respective owner

Related posts about c#

Related posts about httpwebrequest