Cookies and Paths

S

Shane Thomas

Hello,

I'm having difficulty handling cookies with paths other than "/". An
HttpWebRequest object returns these headers:

Date: Tue, 26 Apr 2005 21:29:39 GMT
Server: Apache/1.3.33 (Unix) PHP/4.3.10
Set-cookie: phpusid=12345; path=/; expires=Wednesday, 09-Nov-2008 23:12:40
GMT,data=deleted; expires=Mon, 26-Apr-2004 21:29:38 GMT; path=/stats;
domain=www.somesite.com,data=deleted; expires=Mon, 26-Apr-2004 21:29:38 GMT;
path=/stats; domain=www.somesite.com
X-Powered-By: PHP/4.3.10
Connection: close
Content-Type: text/html

However iterating through a cookie collection (TheResponse.Cookies =
TheRequest.CookieContainer.GetCookies(TheRequest.RequestURI)) only contains
the cookies with a path of "/".

How do I access the cookies with paths other than "/"? Can I gather them all
in one collection?

Thanks,

-shane
 
S

Shane Thomas

I'm having difficulty handling cookies with paths other than "/". An
HttpWebRequest object returns these headers:

Date: Tue, 26 Apr 2005 21:29:39 GMT
Server: Apache/1.3.33 (Unix) PHP/4.3.10
Set-cookie: phpusid=12345; path=/; expires=Wednesday, 09-Nov-2008 23:12:40
GMT,data=deleted; expires=Mon, 26-Apr-2004 21:29:38 GMT; path=/stats;
domain=www.somesite.com,data=deleted; expires=Mon, 26-Apr-2004 21:29:38
GMT; path=/stats; domain=www.somesite.com
X-Powered-By: PHP/4.3.10
Connection: close
Content-Type: text/html

However iterating through a cookie collection (TheResponse.Cookies =
TheRequest.CookieContainer.GetCookies(TheRequest.RequestURI)) only
contains the cookies with a path of "/".

How do I access the cookies with paths other than "/"? Can I gather them
all in one collection?

With a bit more investigation, only cookies in the first path (as specified
in the Set-cookie: header) are stored in the HttpWebResponse container. Once
the path changes they're lost.

I know I'm missing something simple -- googling hasn't helped and nobody's
responded so I'm obviously brain-farting but cannot see it.

Thanks for any pointers,

-shane
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top