473,385 Members | 1,872 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,385 software developers and data experts.

CookieContainer GetCookies fails on multiple Set-Cookies

I am accessing a site that passes the following headers:
Set-Cookie: ASP.NET_SessionId=pwdciy45i0c5me45urxjfoi0; path=/
Set-Cookie: LastSessID=pwdciy45i0c5me45urxjfoi0; expires=Tue,
01-Mar-2016 20:07:11 GMT; path=/
Set-Cookie: pubAccID=04; expires=Tue, 01-Mar-2016 20:07:11 GMT; path=/

I have verified this using ieHttpHeaders

When I use asp.net

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.AllowAutoRedirect = autoRedirect;
req.MaximumResponseHeadersLength = -1;
req.Timeout = timeout;
req.CookieContainer = new CookieContainer();
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
res.Cookies = req.CookieContainer.GetCookies(req.RequestUri);

It only captures "Set-Cookie:
ASP.NET_SessionId=pwdciy45i0c5me45urxjfoi0; path=/"

Am I doing something wrong? Is there a way for me to get all the
headers.

Thanks

Mar 1 '06 #1
1 4617
can someone tell me if there is a better way to get cookies at least?

guyhey wrote:
I am accessing a site that passes the following headers:
Set-Cookie: ASP.NET_SessionId=pwdciy45i0c5me45urxjfoi0; path=/
Set-Cookie: LastSessID=pwdciy45i0c5me45urxjfoi0; expires=Tue,
01-Mar-2016 20:07:11 GMT; path=/
Set-Cookie: pubAccID=04; expires=Tue, 01-Mar-2016 20:07:11 GMT; path=/

I have verified this using ieHttpHeaders

When I use asp.net

HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url);
req.AllowAutoRedirect = autoRedirect;
req.MaximumResponseHeadersLength = -1;
req.Timeout = timeout;
req.CookieContainer = new CookieContainer();
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
res.Cookies = req.CookieContainer.GetCookies(req.RequestUri);

It only captures "Set-Cookie:
ASP.NET_SessionId=pwdciy45i0c5me45urxjfoi0; path=/"

Am I doing something wrong? Is there a way for me to get all the
headers.

Thanks


Mar 7 '06 #2

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

Similar topics

2
by: Joe | last post by:
Hey, I'm going to give some background on my situation in case anyone can point out a way around my problem altogether... for the problem itself, please skip to the bottom of the post. thanks....
4
by: John MacIntyre | last post by:
Hi, I have a page with a series of child pages loaded into an iframe. When I move from page to page, I store an object containing the child's control data in a variable on the main page, then...
0
by: DBQueen | last post by:
I am developing an application for a Pathology Lab. There are Batches (BatchID) which contain multiple Samples (SampleID), and there can be multiple tests run from the same Sample, thus there can...
0
by: Martin Madreza | last post by:
Hello, hope this question wasn't ask to often... I wrote a C# App with an internet connection over HttpWebRequest. To navigate thru some sites i need a cookie (CookieContainer). Now i want...
1
by: VEJIKYUULYCY | last post by:
Hi all, I'm trying to get a .Net client (C# console app) maintain a session with a Java-based web service (Axis), but it doesn't seem to work. (Of course, a Java client to the same service works...
0
by: kkos | last post by:
I noticed the following issue posted as a double-hop issue in many discussion boards but found no answers that explain how to pass the second hop with windows auth from IIS ASPX page to remote SQL...
8
by: mainframetech | last post by:
We are having a problem with Access 2002 as opposed to Access 2000. A multi-file query was set up under 2000 and tested good. Access is connected through a link to an Oracle 9.1 database. The...
0
by: greenxiar | last post by:
Very Simple Code: CookieContainer cc = new CookieContainer(); cc.SetCookies(new Uri("http://some.com/"), "a=1; b=2; path=/; domain=some.com;"); cc.SetCookies(new Uri("http://some.com/"), "a=1;...
6
by: cpptutor2000 | last post by:
Could some C guru please help ? I am writing a Web server on RH 9.0 box. In the section of the code where the Web server has to be initiialized, I have: char host; struct hostent *hp = NULL;...
1
by: Constantine AI | last post by:
Hi i am trying to get User input if data does not exist within a DLOOKUP table. I have gotten it to work for one record but not multiple, i have tried to incorporate my code into a loop procedure but...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.