HTTPWebRequest ?????

Discussion in 'ASP .Net' started by Francois, Jan 16, 2008.

  1. Francois

    Francois Guest

    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.
     
    Francois, Jan 16, 2008
    #1
    1. Advertising

  2. Francois

    Francois Guest

    Adding a stream.closes() added a bit.

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

    Thanks.


    "Francois" <francois@corebridgecom> a écrit dans le message de news:
    %23ZXpn$...
    > 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.
    >
    >
     
    Francois, Jan 16, 2008
    #2
    1. Advertising

  3. Francois

    bruce barker Guest

    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)


    "Francois" wrote:

    > Adding a stream.closes() added a bit.
    >
    > Is there a better coding way to send an XML file ?
    >
    > Thanks.
    >
    >
    > "Francois" <francois@corebridgecom> a écrit dans le message de news:
    > %23ZXpn$...
    > > 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.
    > >
    > >

    >
    >
    >
     
    bruce barker, Jan 16, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Satinderpal Singh

    HttpWebResponse/HttpWebRequest problem...

    Satinderpal Singh, Jun 2, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    3,823
    Satinderpal Singh
    Jun 4, 2004
  2. Greg Reevosh via .NET 247

    Issue with System.Net.HttpWebRequest

    Greg Reevosh via .NET 247, Oct 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    4,401
    Feroze [msft]
    Oct 22, 2004
  3. Greg Reevosh via .NET 247

    Issue with System.Net.HttpWebRequest

    Greg Reevosh via .NET 247, Oct 31, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    456
    Greg Reevosh via .NET 247
    Oct 31, 2004
  4. Sojwal

    HttpWebRequest problem: Please help

    Sojwal, Nov 3, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    466
    Feroze [msft]
    Nov 10, 2004
  5. Greg Reevosh via .NET 247

    Issue with System.Net.HttpWebRequest

    Greg Reevosh via .NET 247, Nov 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    581
    Feroze [msft]
    Nov 19, 2004
Loading...

Share This Page