Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Random Disappearing Cookies across ASP/ASP.net

Reply
Thread Tools

Random Disappearing Cookies across ASP/ASP.net

 
 
Raterus
Guest
Posts: n/a
 
      06-29-2004
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
 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      06-29-2004
"Raterus" <> wrote in message news:...
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.
--
John Saunders
johnwsaundersiii at hotmail

 
Reply With Quote
 
 
 
 
Raterus
Guest
Posts: n/a
 
      06-30-2004
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 = "/"
"John Saunders" <> wrote in message news:...
"Raterus" <> wrote in message news:...
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.
--
John Saunders
johnwsaundersiii at hotmail

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
Give Request.Cookies and Response.Cookies is there any reason to use another method to use cookies? _Who ASP .Net 7 09-18-2008 07:49 PM
random.random(), random not defined!? globalrev Python 4 04-20-2008 08:12 AM
"Disappearing cookies": any change in ASP.NET 2.0? ASP .Net 2 08-17-2005 11:58 AM
Disappearing cookies after login.aspx Mach Runner ASP .Net 0 08-16-2004 04:19 AM



Advertisments