all cookies disappear after round trip to client

  • Thread starter Thread starter Peter Row
  • Start date Start date
P

Peter Row

Hi,

I have a web app, there is only really 1 aspx page (that the user never
sees) the rest of the code is done in a DLL that implements HttpHandler.
My app (which is a porting job from Vb6 webclasses) needs to use session
cookies (i.e. when all browser windows are closed the cookies disappear)
however in my code the cookies disappear after a round trip to the client
browser, i.e:

Browser
|
- request
|
web server - does code, sets cookies
|
- response
|
Browser
|
- request
|
web server - checks cookie set from 1st request *&%!!"- they are all gone.

I have an asp wrapper class that has a member variable of type Httpcontext
this gives me access to all the asp objects like request etc...
I have a property ClientVars() which wraps up the cookie access. What
ClientVars() does to set a cookie is this:

m_context.Response.Cookies(m_strCookieName)(strName) = Value

And I get the cookie (after a decision) with either:

m_context.Response.Cookies(m_strCookieName)(strName)
or
m_context.Request.Cookies(m_strCookieName)(strName)

The reason for the above decision in the get bit is so that if I set a
cookie and then in the same request ask for the cookie again it will give it
me from the response instead of the request.

m_strCookieName gets set when the my asp wrapper class is initialised to the
path from URL, i.e. if my url was http://localhost/testVersion, then
m_strCookieName would be "testVersion", if the url was http://localhost it
would be an empty string.

The pages that the user gets includes JS that creates a cookieJar (from the
O'Reily JS books), but the cookies I am interested in on the 2nd request are
not touched my the JS cookieJar stuff in terms of setting, and even if they
were my .NET code should still be able to see the ones it initially set.

One curious thing that I do see on the 2nd request (side effect of JS
perhaps?) is that in the Request.Cookies.AllKeys collection (given the
example URL above) there are now 2 keys called "testVersion" whereas during
the 1st request there was only one. If I access either of them using there
index values:

? m_context.Request.Cookies(1)(0)
or
? m_context.Request.Cookies(3)(0)

The cookies in between index 1 and 3 are things like ASP__SESSION or
similar, which I don't use and didn't set.

....respectively then each returns Nothing, so all my cookies set in 1st
request have disappeared.

Any help working out where these cookies are going would be highly
appreciated.

Regards,
Peter Row
 
Back
Top