Random Disappearing Cookies across ASP/ASP.net

R

Raterus

Howdy,

I have one IIS Application, with asp/asp.net pages. I set a cookie like so in an ASP page.

Response.Cookies("AuthCookie")("hash") = md5(username & Application("HashCode")) Response.Cookies("AuthCookie")("username") = username

Then I response.redirect to my asp.net page, which is protected by Forms Authentication, so Application_AuthenticateRequest Fires..and I try to access this cookie like so..

Dim authCookie As HttpCookie = Context.Request.Cookies("AuthCookie")

....Sometimes the cookie is there ...Sometimes it isn't there

Very Confusing.

The site always stays in one browser window, I've tried messing with cookie security, without success. I've also noticed that along with this cookie, lots of other cookies dissapear, like the session cookies asp/asp.net sets.

Any ideas, this one has me baffled..?
--Michael
 
J

John Saunders

Howdy,

I have one IIS Application, with asp/asp.net pages. I set a cookie like so in an ASP page.

Response.Cookies("AuthCookie")("hash") = md5(username & Application("HashCode")) Response.Cookies("AuthCookie")("username") = username

Then I response.redirect to my asp.net page, which is protected by Forms Authentication, so Application_AuthenticateRequest Fires..and I try to access this cookie like so..

Dim authCookie As HttpCookie = Context.Request.Cookies("AuthCookie")

...Sometimes the cookie is there ...Sometimes it isn't there

Very Confusing.

The site always stays in one browser window, I've tried messing with cookie security, without success. I've also noticed that along with this cookie, lots of other cookies dissapear, like the session cookies asp/asp.net sets.

Any ideas, this one has me baffled..?

Michael, cookies don't just disappear. What happens is that the browser sends them or not, as it sees fit.

One of the most-frequent causes of "cookie loss" involves issues with the domain of the cookie versus the domain of the site. Is it possible that sometimes you are using localhost and other times mymachine.com? If you created the cookie with "mymachine.com" as its domain, it would not appear on pages from localhost.
 
R

Raterus

I "think" I have this fixed, it had to do with the path of the variable not being set properly. I set the path in asp to this.

Response.Cookies("AuthCookie").path = "/"
Howdy,

I have one IIS Application, with asp/asp.net pages. I set a cookie like so in an ASP page.

Response.Cookies("AuthCookie")("hash") = md5(username & Application("HashCode")) Response.Cookies("AuthCookie")("username") = username

Then I response.redirect to my asp.net page, which is protected by Forms Authentication, so Application_AuthenticateRequest Fires..and I try to access this cookie like so..

Dim authCookie As HttpCookie = Context.Request.Cookies("AuthCookie")

...Sometimes the cookie is there ...Sometimes it isn't there

Very Confusing.

The site always stays in one browser window, I've tried messing with cookie security, without success. I've also noticed that along with this cookie, lots of other cookies dissapear, like the session cookies asp/asp.net sets.

Any ideas, this one has me baffled..?

Michael, cookies don't just disappear. What happens is that the browser sends them or not, as it sees fit.

One of the most-frequent causes of "cookie loss" involves issues with the domain of the cookie versus the domain of the site. Is it possible that sometimes you are using localhost and other times mymachine.com? If you created the cookie with "mymachine.com" as its domain, it would not appear on pages from localhost.
 

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

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top