HttpWebRequest

Discussion in 'ASP .Net Web Services' started by Nissim, Jan 4, 2004.

  1. Nissim

    Nissim Guest

    Thanks again ...
    i'm sorry, May be my problem was not explained properly.
    i need to read from console app several HTML content.
    i know how to do that with HttpWebRequest and
    HttpWebResponse , and its work .
    the problem is that every page i read is a new session in
    the web server.
    i want to read all the 100 html pages in only one session.
    is that possible?
    Thanks
    Nissim
     
    Nissim, Jan 4, 2004
    #1
    1. Advertising

  2. Nissim wrote:


    > i need to read from console app several HTML content.
    > i know how to do that with HttpWebRequest and
    > HttpWebResponse , and its work .
    > the problem is that every page i read is a new session in
    > the web server.
    > i want to read all the 100 html pages in only one session.
    > is that possible?


    I think the answers you have already got suggest that you need to use
    the CookieContainer of the first HttpWebResponse with all following
    HttpWebRequests. Have you tried that?
    Usually a web server application keeps track of sessions by sending out
    a cookie with the session id and the client sends that sesssion id
    cookie back. Thus if you use the CookieContainer containing the session
    id cookie the server sends back on the first request then all your
    following requests should be in the same session.

    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Jan 4, 2004
    #2
    1. Advertising

  3. What exactly do you mean by "Session" ? Do you mean application sessions
    (implemented using cookies for example) or TCP connection sessions ?

    If former, use CookieContainer as the other posters have suggested.

    If latter, you should be using KeepAlive=true on the webrequest ( which is
    the default). One of the reasons that you are not seeing this default
    behavior could be that you are using Windows Integrated Authentication on
    the server. Is that the case ?

    feroze.

    --
    Remove "user" from the email address to reply to the author.

    This posting is provided "AS IS" with no warranties, and confers no rights

    Use of included script samples are subject to the terms specified at
    http://www.microsoft.com/info/cpyright.htm




    "Martin Honnen" <> wrote in message
    news:#...
    >
    >
    > Nissim wrote:
    >
    >
    > > i need to read from console app several HTML content.
    > > i know how to do that with HttpWebRequest and
    > > HttpWebResponse , and its work .
    > > the problem is that every page i read is a new session in
    > > the web server.
    > > i want to read all the 100 html pages in only one session.
    > > is that possible?

    >
    > I think the answers you have already got suggest that you need to use
    > the CookieContainer of the first HttpWebResponse with all following
    > HttpWebRequests. Have you tried that?
    > Usually a web server application keeps track of sessions by sending out
    > a cookie with the session id and the client sends that sesssion id
    > cookie back. Thus if you use the CookieContainer containing the session
    > id cookie the server sends back on the first request then all your
    > following requests should be in the same session.
    >
    > --
    >
    > Martin Honnen
    > http://JavaScript.FAQTs.com/
    >
     
    Feroze [MSFT], Jan 7, 2004
    #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,837
    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,436
    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:
    462
    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:
    474
    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:
    588
    Feroze [msft]
    Nov 19, 2004
Loading...

Share This Page