Re: Cookie Expire

From: Scott M. (s-mar_at_nospam.nospam)
Date: 08/31/04


Date: Tue, 31 Aug 2004 16:42:22 -0400


"Stefan" <shogun@steffsworld.ch> wrote in message
news:%239tnztxjEHA.1040@TK2MSFTNGP10.phx.gbl...
> In the Global.asax file there are some "speciel" sections where you can
> handle your problem
> I think it's OnSession_End where you can write your code.
> But you don't have set the Cookie expire to yesterday.
> Use the following code instead
> Response.Cookies("loginInfo").Expires = DateTime.Now.

But again, the information about the expiration date must be transmitted to
the browser so that it can remove the cookie. If they have closed their
browser, it won't get the information about the expiration in your code
above becaue there is no browser to respond to.

Also, when you close your browser, the server is not alerted, so after 20
minutes (the default session timeout period), the code you have above will
run. In other words, your code won't until for 20 minutes AFTER the browser
has closed. Your code would be fine if the user uses the "log off" feature
of the site because then, the code can call session.abandon and your code
will run immediately. But the OP stated that his/her problem is that users
aren't logging off, they are just shutting their browser down.

>
> Cheers
> Stefan
> "Big E" <nospam@nospam.com> schrieb im Newsbeitrag
> news:uMXT%236tjEHA.2236@TK2MSFTNGP12.phx.gbl...
>>I set a cookie at a login screen that sets various information. When users
>> are finished with the application most of them close the browser instead
>> of
>> clicking logoff.
>> How do I clear or remove cookies when the shut down the broswer. I know
>> how
>> to remove them like this:
>>
>> Private Sub RemoveCookies()
>> If Request.QueryString("AcceptsCookies") Is Nothing Then
>> Response.Cookies("loginInfo").Expires = DateTime.Now.AddDays(-1)
>> End If
>> End Sub
>>
>> But how do I force this when the browser closes.
>>
>> Thanks.
>>
>> Big E
>>
>>
>>
>
>



Relevant Pages

  • Re: deleting cookies and local browser time versus server time
    ... Our server ... is in a different time zone than the browser I'm developing on. ... How can I test cookie expiration with that? ...
    (comp.lang.php)
  • Re: Attempt to de-mystify AJAX
    ... "Hyperlinks" always open a new browser window. ... key (cookie) is still there and still contains the original value. ... You can get the cookies from the HTTP_COOKIE CGI environment variable. ...
    (comp.databases.pick)
  • Re: NSA Used Cookies to Track Visitors Web Activities?
    ... Could unwittingly installing a compromised browser open the doors wide to cookie-based intrusions? ... A cookie itself is unlikely to be a virus, but if the browser code is written in C, it is very likely to have arrays that are susceptible to "buffer overrun" Sometimes a clever enough person can use such a bug to cause executable code stored in an allegedly non-executable file to replace code in your browser or operating system. ... an external intruder coming in over an Internet connection, presumably that intruder would have access to the cookies on one's machine. ...
    (comp.sys.mac.system)
  • Re: Great SWT Program
    ... Every browser I've ever ... server when requesting any URLs from that server. ... doesn't send the cookie. ... every so often nail the ones that got by adblock, ...
    (comp.lang.java.programmer)
  • Re: Cookies from ASP.NET app not persisting even when enabled!
    ... > I'm new to ASP.NET and have been developing a small app at work to test ... > and the authorization cookie is saved as expected on the local machine. ... any browser OTHER THAN the one on the development ...
    (microsoft.public.dotnet.framework.aspnet)