HTTPWebRequest ?????

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.
 
F

Francois

Adding a stream.closes() added a bit.

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

Thanks.
 
B

bruce barker

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top