HTTPWebRequest ?????

  • Thread starter Thread starter Francois
  • Start date Start date
F

Francois

Hello,

I cannot understand how this works ...


I do :

XmlDocuement DocIn = new XmlDocument();

blah blah for DocIn.

try{
MyRequest =
(HttpWebRequest)HttpWebRequest.Create("http://myserver/myxmlweb/Default.aspx");
MyRequest.Method = "POST";
MyRequest.ContentType = "text/xml;";
DocIn.Save(MyRequest.GetRequestStream());
MyRequest.Timeout = 5000;
//Get Response
HttpWebResponse = (HttpWebResponse)MyRequest.GetResponse();
}
catch(E ...

And I am locked forever in GetResponse(). No exception, no timeout, just
plain dull lock.

What s wrong ?

mysever uses integrated IIS authentification. I do set any credential for
myRequest. So I am expecting at least a HTTP 401 response.

Thanks.
 
Adding a stream.closes() added a bit.

Is there a better coding way to send an XML file ?

Thanks.
 
it all depends on the server you are posting to, and how the file is handled.
its common for the server to not send the response until the he request has
been completely received.

with webrequest and a post, until you close the stream, there is no way to
know when you are done send data to the server.

now with the right server you could could keep the sockets open and have
both streams going.

-- bruce (sqlwork.com)
 
Back
Top