Note that there are some explanatory texts on larger screens.

plurals
  1. PODoes anyone know why I receive an HttpWebRequest Timeout?
    primarykey
    data
    text
    <p>I was wondering if you can help me with a bug I ma having. I have a HTTP Manager I have created that helps me dealing with POSTing/GETing data from websites. It has worked fine until recently when I am trying to use a mixture of both. First loop round everything works, on the second loop it hangs on HttpWebRequest.GetRequestStream(). I have read all over the net and have found no real solution. Below are the codeblocks for the fetching/receiving:</p> <pre><code> ASCIIEncoding encoding = new ASCIIEncoding(); byte[] buffer = encoding.GetBytes(_PostData); _HttpWebRequest = (HttpWebRequest)WebRequest.Create(_FetchUrl); _HttpWebRequest.Credentials = _Credentials; _HttpWebRequest.Method = _RequestType.ToString(); _HttpWebRequest.ContentType = "application/x-www-form-urlencoded"; _HttpWebRequest.ContentLength = buffer.Length; _HttpWebRequest.UserAgent = userAgent; _HttpWebRequest.CookieContainer = _CookieContainer; _HttpWebRequest.KeepAlive = false; _HttpWebRequest.AllowAutoRedirect = _AllowAutoRedirect; _HttpWebRequest.AutomaticDecompression = DecompressionMethods.GZip; _HttpWebRequest.ServicePoint.Expect100Continue = false; if (_RequestType.Equals(RequestTypes.POST)) { // Write POST Stream reqStream = _HttpWebRequest.GetRequestStream(); { reqStream.Write(buffer, 0, buffer.Length); reqStream.Flush(); reqStream.Close(); } } </code></pre> <p>And the reponse:</p> <pre><code>HttpWebResponse httpWebResponse = (HttpWebResponse)_HttpWebRequest.GetResponse(); { Stream responseStream = httpWebResponse.GetResponseStream(); { if (_UseGzip) { if (httpWebResponse.ContentEncoding.ToLower().Contains("gzip")) { responseStream = new GZipStream(responseStream, CompressionMode.Decompress); } else { responseStream = new DeflateStream(responseStream, CompressionMode.Decompress); } } if (responseStream != null) { StreamReader streamReader = new StreamReader(responseStream); { try { _PageContent = streamReader.ReadToEnd(); } finally { streamReader.Close(); responseStream.Close(); httpWebResponse.Close(); } } } else { _PageContent = string.Empty; } } } _HttpWebRequest.Abort(); </code></pre> <p>Can anyone see any flaws to why my code is hanging? All streams are being closed, I have set the allowed connections to over 100, I don't understand why this is breaking.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload