Re: Simple question about cookies



Yes I am confused. When the clicks on log out link, I set the expiry to past
date. But when I click on one of secured pages (pages that check "tick"
cookie before displaying the page) they allow me to see the page whcih
shouldn't happen because cookie is expired. In short my logout is not
working out.

Joe


"Tom.PesterDELETETHISSS@xxxxxxxxxx" wrote:

>
> I tested your code and it does what is exepcted. Once the server sends a
> cookie with the expire date in the past it wont send the cookie to the server
> the next time.
>
> Don't forget that when the browser requests the logout page it will still
> send the cookie. The logout page sends the command to forget the cookie and
> _only then_ the browser wont send it next time.
>
> Is that what's confusing you?
>
> Let me know if you have any more questions..
>
> Cheers,
> Tom Pester
>
> > Hi,
> >
> > I'm creating a cookie named "tick" that should expire after 1 day when
> > user logs in.
> >
> > TheDomain = ".www.test.com"
> > ThePath = "/dir1/subdir"
> > Response.Cookies("tick")("ID") = Session("userEmail")
> > Response.Cookies("tick").Expires = DateAdd("d", 1, Now())
> > Response.Cookies("tick").Domain = TheDomain
> > Response.Cookies("tick").Path = ThePath
> > I want to have a logout link. When clicked, I am trying to set the
> > expiry date of cookie to say 5 days back like this to tell browser
> > that this cookie has expired and it should remove it.
> >
> > Response.Cookies("tick").Expires = DateAdd("d", -5, Now())
> >
> > But I noticed that I am not able to change the cookie's expiry date by
> > above line. Can someone tell me what mistake I'm making?
> >
> > Thanks,
> >
> > Joe
> >
>
>
>
.



Relevant Pages

  • Re: Custom Roles Cookie solution always stores itself persistently?
    ... To get a non persistent session based cookie you must leave the cookie's ... into the ticket not applied to the cookie's expiry date. ... > In the UpdateUserRoles function, I Trace.Warn the persist value on the ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • CGI::Cookie Setting Expiry
    ... I got the basic coding from perdoc on the usage of use CGI::Cookie. ... examples show an expiry of '+3M' which they say means 3 months. ... like my cookie to expire after 10 minutes. ...
    (comp.lang.perl.misc)
  • Re: session question
    ... It's because no expiration date is set on the session id cookie ... Session expiry isn't implemented using the cookie expiry. ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • RE: Cookie Expires In 2.0 Framework
    ... "Adam Bates" wrote: ... The cookie has an expiry date which is in the future. ... hosting company from a server with 1.1 framework to a server with 2.0 ...
    (microsoft.public.dotnet.languages.csharp)
  • Referencing variable in calling class?
    ... I assume because the cookie destruction is being sent down in that page ... when that page renders it still appears as if the user is logged ... So, I thought perhaps as part of my logout routine, I could set a variable ... whether or not it displays the 'login' url or the 'logout' url. ...
    (php.general)