Re: Cookie Expire
From: Scott M. (s-mar_at_nospam.nospam)
Date: 08/31/04
- Next message: Steve C. Orr [MVP, MCSD]: "Re: force page refresh with response.expires=0?"
- Previous message: Thomas Dodds: "Re: Save Record With "For Each ctrl In Me.controls" Statement"
- Maybe in reply to: Kevin Spencer: "Re: Cookie Expire"
- Messages sorted by: [ date ] [ thread ]
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
>>
>>
>>
>
>
- Next message: Steve C. Orr [MVP, MCSD]: "Re: force page refresh with response.expires=0?"
- Previous message: Thomas Dodds: "Re: Save Record With "For Each ctrl In Me.controls" Statement"
- Maybe in reply to: Kevin Spencer: "Re: Cookie Expire"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|