title: C# AccessViolationException was unhandled
body: <p>I write down a multi-threading program to get page info.Debugging this program some time ,it will show this error "Access Violation Exception was unhandled.Attempted to read or write protected memory. This is often an indication that other memory is corrupt." on "response = (HttpWebResponse)request.GetResponse();" sentence.If i just only get the error page,it's running well. How can I fix this problem?</p>
  
  <pre><code>  public void HttpWeb(string url)
      {
              request = (HttpWebRequest)WebRequest.Create(new Uri(url));
              request.UserAgent = "Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Win64; x64; Trident/5.0)";
              request.Accept = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8;q=0.5";
              request.Headers.Add("Accept-Encoding", "gzip,deflate");
              request.ProtocolVersion = HttpVersion.Version10;
              request.AllowAutoRedirect = IsLogin ? true : false;
              request.KeepAlive = IsLogin ? false : true;
              request.Timeout = 50 * 1000;
              response = (HttpWebResponse)request.GetResponse();
              //.....
  </code></pre>