473,395 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

HttpWebRequest With Session

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

Aug 14 '06 #1
3 3103
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<yo**@nobhillsoft.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
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

Aug 14 '06 #2
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!
Nicholas Paldino [.NET/C# MVP] wrote:
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<yo**@nobhillsoft.comwrote in message
news:11**********************@i3g2000cwc.googlegro ups.com...
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
Aug 14 '06 #3
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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<yo**@nobhillsoft.comwrote in message
news:11**********************@74g2000cwt.googlegro ups.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
head... either the online help, an MSDN article or anything like that
where they talk about it? thanks!
Nicholas Paldino [.NET/C# MVP] wrote:
>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.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<yo**@nobhillsoft.comwrote in message
news:11**********************@i3g2000cwc.googlegr oups.com...
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

Aug 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Craig | last post by:
I wrote a generic page to do HttpWebRequest operations based on 3 querystring parameters for the uri, username, and password for basic authentication pages. The page is designed to help with...
2
by: Keith Patrick | last post by:
I'm trying to programmatically post data to another page within my ASP.Net app. Not POSTing is not an option (I can't store this data in my session, context, hidden fields, or anything else...I've...
11
by: Keith Patrick | last post by:
Could someone explain to me the relationship between these two classes? I am ripping my hair out trying to divert an HttpRequest to a new location via an HttpWebRequest, but I cannot get my...
4
by: Chris Newby | last post by:
My project currently requires that I integrate an ASP.NET application with an ASP application. One of the issues I'm having is that I have some very long strings being created in an ASP.NET...
2
by: Xpou | last post by:
Hi, I have a windows form app which makes post httpwebrequests to the same pages of the same web site several times. This web site generates a "phpsessid" which is a session id residing in...
10
by: rlueneberg | last post by:
I am trying to foward the old sessionID using "Session.SessionID" to an HttpWebRequest CookieContainer so that I can capture the requested page session variables but it is not working as it is...
1
by: ALA | last post by:
Hi, does anybody know if it is possible to pass the SessionID with a web request by using a cookie so that the invoked page in the same domain can access the session objects of the current user?...
0
by: Crysnon | last post by:
My current goal is to be able to get the HTML source of an ASP.Net page that is hosted locally. Even though I make sure the session id is stored in the cookie container of the HttpWebRequest the...
0
by: kgabrys | last post by:
I have an C# Windows application that is to connect to a remote HTTPS website, POST the login, then subsequently POST a file and get the response. There is plenty of code out there that shows this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.