Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2006

Tip: Looking for answers? Try searching our database.

HttpWebRequest With Session

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
yoni@nobhillsoft.com - 14 Aug 2006 15:25 GMT
Hi,
I am using HttpWebRequest to get the content of a web page. the call to
this web page is creating a session on the server. then, I wish to get
the content of a 2nd web page on the same site, but this 2nd web page
reads the session created on the 1st page. so when i call it with
HttpWebRequest, it lost the session. anybody has a tip or a code
snippet that shows me how do i make the server retain the session
between two HttpWebRequest calls?

thanks
Nicholas Paldino [.NET/C# MVP] - 14 Aug 2006 15:35 GMT
What you need to do is in the response for the first request, there will
be cookies that are sent back.  You need to include these cookies as part of
your second request.  One of these cookies has an identifier in it which
idenfies the session.

   Hope this helps.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Hi,
> I am using HttpWebRequest to get the content of a web page. the call to
[quoted text clipped - 6 lines]
>
> thanks
yoni@nobhillsoft.com - 14 Aug 2006 15:42 GMT
This sure helps! what would help more is if you can refer me to any
code sample where its done... do you have anything off the top of your
head... either the online help, an MSDN article or anything like that
where they talk about it? thanks!
> What you need to do is in the response for the first request, there will
> be cookies that are sent back.  You need to include these cookies as part of
[quoted text clipped - 17 lines]
> >
> > thanks
Nicholas Paldino [.NET/C# MVP] - 14 Aug 2006 16:38 GMT
Take a look at the CookieContainer property on the HttpWebRequest.  You
should be able to assign a new CookieContainer instance to it.  Then, the
response should populate a cookie collection in the container.  Just make
sure that you store a reference to the CookieContainer so that you can
assign it to the new request.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> This sure helps! what would help more is if you can refer me to any
> code sample where its done... do you have anything off the top of your
[quoted text clipped - 22 lines]
>> >
>> > thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.