Random Disappearing Cookies across ASP/ASP.net

Discussion in 'ASP .Net' started by Raterus, Jun 29, 2004.

  1. Raterus

    Raterus Guest

    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
     
    Raterus, Jun 29, 2004
    #1
    1. Advertising

  2. "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
     
    John Saunders, Jun 29, 2004
    #2
    1. Advertising

  3. Raterus

    Raterus Guest

    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
     
    Raterus, Jun 30, 2004
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Guest
    Replies:
    2
    Views:
    986
    Juan T. Llibre
    Aug 17, 2005
  2. globalrev
    Replies:
    4
    Views:
    775
    Gabriel Genellina
    Apr 20, 2008
  3. Davey P

    Disappearing ASP Cookies

    Davey P, Jun 10, 2008, in forum: ASP .Net
    Replies:
    0
    Views:
    298
    Davey P
    Jun 10, 2008
  4. _Who
    Replies:
    7
    Views:
    2,687
  5. VK
    Replies:
    15
    Views:
    1,184
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page