HTTPWebRequest hangs in ASP.NET
I have code that sends a POST to a URL using HTTPWebRequest. When I use the following code inside ASP.NET, the line stream.Write() hangs.
request = ".....";
Stream stream = httpRequest.GetRequestStream();
stream.Write( scmpRequest, 0, scmpRequest.Length );
byte[] byte1 = encoding.GetBytes(request);
httprequest.ContentLength = request.Length;
httprequest.Method = "POST";
httprequest.TransferEncoding = "UTF8";
httprequest.ContentType = "text/xml; encoding='utf-8'";
requestStream = httprequest.GetRequestStream();
requestStream.Write(byte1, 0, byte1.Length);
requestStream.Flush();
requestStream.Close();
What could I be missing or not doing right? Any configuration settings I need to be aware of to allow POSTs to other servers from within an .aspx file?
Note: It is actually able to send the data to the server. I know because we also own the server that I'm posting to and I can see my requests coming in. So, I think the problem is that Write() just won't return for some reason.
Thanks. I'm really desperate, pleas help me :(.
|