HttpWebRequest

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

Advertisements

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

Advertisements

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

"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/
>

Share This Page

Welcome to The Coding Forums!

Welcome to the Coding Forums, the place to chat about anything related to programming and coding languages.

Please join our friendly community by clicking the button below - it only takes a few seconds and is totally free. You'll be able to ask questions about coding or chat with the community and help others.
Sign up now!