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();
}
<system.net>
<settings>
<httpWebRequest maximumResponseHeadersLength ="32" useUnsafeHeaderParsing ="true" />
</settings>
</system.net>