473,320 Members | 1,572 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Browser Close ....

My development environment is Framework 1.1, ASP.Net and IE 6.X.

I have logout button in all the screens in the application. I am doing
database activity when the user clicks on logout button. However the user
can close the application using the IE close cross mark. When the user
closes the application without logout button all my database routine and
logout activities will not be called. Any solution for this kind of
situation? Thanks for your thoughts.

Harry
Nov 18 '05 #1
20 1998
"Harry" <Ha************@hotmail.com> wrote in news:#LVbPOUiEHA.1040
@TK2MSFTNGP09.phx.gbl:
Any solution for this kind of
situation?


Look at the Global.asax file. There are several event handlers you can
use... such as On Session End. On session end is executed when the session
times out - generally 20 minutes.
--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #2
If you are using session state, in the session_end event, call the log out
routine for the current user.

"Harry" <Ha************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
My development environment is Framework 1.1, ASP.Net and IE 6.X.

I have logout button in all the screens in the application. I am doing
database activity when the user clicks on logout button. However the user
can close the application using the IE close cross mark. When the user
closes the application without logout button all my database routine and
logout activities will not be called. Any solution for this kind of
situation? Thanks for your thoughts.

Harry

Nov 18 '05 #3
>
"Harry" <Ha************@hotmail.com> wrote in news:#LVbPOUiEHA.1040
@TK2MSFTNGP09.phx.gbl:
Any solution for this kind of
situation?
Look at the Global.asax file. There are several event handlers you can
use... such as On Session End. On session end is executed when the

session times out - generally 20 minutes.
In ASP classic, the session onend event was very unreliable. Is this not
the case in .NET? Thanks

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 18 '05 #4
It's just that it may not fire till the session times out if the user used
the"X" as the OP indicated. Still the same issue(s) but it's still about
your only real way of doing it.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
<St*************@IDX.COM> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...

"Harry" <Ha************@hotmail.com> wrote in news:#LVbPOUiEHA.1040
@TK2MSFTNGP09.phx.gbl:
> Any solution for this kind of
> situation?


Look at the Global.asax file. There are several event handlers you can
use... such as On Session End. On session end is executed when the

session
times out - generally 20 minutes.

In ASP classic, the session onend event was very unreliable. Is this not
the case in .NET? Thanks

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 18 '05 #5
> In ASP classic, the session onend event was very unreliable. Is this not
the case in .NET? Thanks


Define "unreliable."

Sessions in ASP would time out after an interval of inactivity (no requests
from browser). ASP.Net behaves the same way. But you could and can always be
certain of one thing: Sessions end. When they end, the Session_End Event
Handler is called. Is that reliable enough for you?

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

<St*************@IDX.COM> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...

"Harry" <Ha************@hotmail.com> wrote in news:#LVbPOUiEHA.1040
@TK2MSFTNGP09.phx.gbl:
Any solution for this kind of
situation?


Look at the Global.asax file. There are several event handlers you can
use... such as On Session End. On session end is executed when the

session
times out - generally 20 minutes.

In ASP classic, the session onend event was very unreliable. Is this not
the case in .NET? Thanks

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 18 '05 #6
when the user closes the IE by clicking the X mark on the title bar,
Session_End routine is not getting triggered.
Am I doing something wrong?
Harry
"Marina" <so*****@nospam.com> wrote in message
news:OI*************@TK2MSFTNGP12.phx.gbl...
If you are using session state, in the session_end event, call the log out
routine for the current user.

"Harry" <Ha************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
My development environment is Framework 1.1, ASP.Net and IE 6.X.

I have logout button in all the screens in the application. I am doing
database activity when the user clicks on logout button. However the user can close the application using the IE close cross mark. When the user
closes the application without logout button all my database routine and
logout activities will not be called. Any solution for this kind of
situation? Thanks for your thoughts.

Harry


Nov 18 '05 #7
No. That will get triggered when the session times out due to inactivity.
That setting is in web.config.

"Harry" <Ha************@hotmail.com> wrote in message
news:ey**************@TK2MSFTNGP10.phx.gbl...
when the user closes the IE by clicking the X mark on the title bar,
Session_End routine is not getting triggered.
Am I doing something wrong?
Harry
"Marina" <so*****@nospam.com> wrote in message
news:OI*************@TK2MSFTNGP12.phx.gbl...
If you are using session state, in the session_end event, call the log out
routine for the current user.

"Harry" <Ha************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
My development environment is Framework 1.1, ASP.Net and IE 6.X.

I have logout button in all the screens in the application. I am doing
database activity when the user clicks on logout button. However the

user can close the application using the IE close cross mark. When the user
closes the application without logout button all my database routine and logout activities will not be called. Any solution for this kind of
situation? Thanks for your thoughts.

Harry



Nov 18 '05 #8
so what is the conclusion? Is there any I can handle it?
Harry
"Marina" <so*****@nospam.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
No. That will get triggered when the session times out due to inactivity.
That setting is in web.config.

"Harry" <Ha************@hotmail.com> wrote in message
news:ey**************@TK2MSFTNGP10.phx.gbl...
when the user closes the IE by clicking the X mark on the title bar,
Session_End routine is not getting triggered.
Am I doing something wrong?
Harry
"Marina" <so*****@nospam.com> wrote in message
news:OI*************@TK2MSFTNGP12.phx.gbl...
If you are using session state, in the session_end event, call the log out routine for the current user.

"Harry" <Ha************@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
> My development environment is Framework 1.1, ASP.Net and IE 6.X.
>
> I have logout button in all the screens in the application. I am doing > database activity when the user clicks on logout button. However the

user
> can close the application using the IE close cross mark. When the user > closes the application without logout button all my database routine and > logout activities will not be called. Any solution for this kind of
> situation? Thanks for your thoughts.
>
> Harry
>
>



Nov 18 '05 #9
The conclusion is that you can handle it, but only when the session times
out. There is no way the server can know what the user does on their
computer as far as which IE windows are kept open, and which are closed
suddenly. All the server can know is the last time a request was made from a
client with a particular session id. And when the client hasn't made a
request for some amt of time, it can kill the session and raise the
session_end event.

"Harry" <Ha************@hotmail.com> wrote in message
news:uA**************@TK2MSFTNGP10.phx.gbl...
so what is the conclusion? Is there any I can handle it?
Harry
"Marina" <so*****@nospam.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
No. That will get triggered when the session times out due to inactivity.
That setting is in web.config.

"Harry" <Ha************@hotmail.com> wrote in message
news:ey**************@TK2MSFTNGP10.phx.gbl...
when the user closes the IE by clicking the X mark on the title bar,
Session_End routine is not getting triggered.
Am I doing something wrong?
Harry
"Marina" <so*****@nospam.com> wrote in message
news:OI*************@TK2MSFTNGP12.phx.gbl...
> If you are using session state, in the session_end event, call the log
out
> routine for the current user.
>
> "Harry" <Ha************@hotmail.com> wrote in message
> news:%2****************@TK2MSFTNGP09.phx.gbl...
> > My development environment is Framework 1.1, ASP.Net and IE 6.X.
> >
> > I have logout button in all the screens in the application. I am doing > > database activity when the user clicks on logout button. However
the user
> > can close the application using the IE close cross mark. When the

user > > closes the application without logout button all my database routine and
> > logout activities will not be called. Any solution for this kind

of > > situation? Thanks for your thoughts.
> >
> > Harry
> >
> >
>
>



Nov 18 '05 #10
Exactly as mentioned... it's your only real choice other then rethinking
what you are trying to do.
It's a misconception in the methodology. WWW isn't designed to act like a
windows app, dont try to force it.

--
Curt Christianson
Owner/Lead Developer, DF-Software
Site: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Harry" <Ha************@hotmail.com> wrote in message
news:uA**************@TK2MSFTNGP10.phx.gbl...
so what is the conclusion? Is there any I can handle it?
Harry
"Marina" <so*****@nospam.com> wrote in message
news:uX**************@tk2msftngp13.phx.gbl...
No. That will get triggered when the session times out due to inactivity.
That setting is in web.config.

"Harry" <Ha************@hotmail.com> wrote in message
news:ey**************@TK2MSFTNGP10.phx.gbl...
> when the user closes the IE by clicking the X mark on the title bar,
> Session_End routine is not getting triggered.
> Am I doing something wrong?
> Harry
>
>
> "Marina" <so*****@nospam.com> wrote in message
> news:OI*************@TK2MSFTNGP12.phx.gbl...
> > If you are using session state, in the session_end event, call the
> > log

out
> > routine for the current user.
> >
> > "Harry" <Ha************@hotmail.com> wrote in message
> > news:%2****************@TK2MSFTNGP09.phx.gbl...
> > > My development environment is Framework 1.1, ASP.Net and IE 6.X.
> > >
> > > I have logout button in all the screens in the application. I am doing > > > database activity when the user clicks on logout button. However
> > > the
> user
> > > can close the application using the IE close cross mark. When the user > > > closes the application without logout button all my database
> > > routine

and
> > > logout activities will not be called. Any solution for this kind of
> > > situation? Thanks for your thoughts.
> > >
> > > Harry
> > >
> > >
> >
> >
>
>



Nov 18 '05 #11
> > In ASP classic, the session onend event was very unreliable. Is this
not
the case in .NET? Thanks
Define "unreliable."

Sessions in ASP would time out after an interval of inactivity (no

requests from browser). ASP.Net behaves the same way. But you could and can always > be certain of one thing: Sessions end. When they end, the Session_End Event
Handler is called. Is that reliable enough for you?
In classic ASP, Sessions certainly ended. But the Session_OnEnd event did
NOT always fire. That is what I meant by unreliable.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

<St*************@IDX.COM> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...

"Harry" <Ha************@hotmail.com> wrote in news:#LVbPOUiEHA.1040
@TK2MSFTNGP09.phx.gbl:

> Any solution for this kind of
> situation?

Look at the Global.asax file. There are several event handlers you can use... such as On Session End. On session end is executed when the

session
times out - generally 20 minutes.

In ASP classic, the session onend event was very unreliable. Is this not the case in .NET? Thanks

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/


Nov 18 '05 #12
I started using ASP when it first came out. In all these years I have never
heard anyone claim that the Session_End event would not fire every time. I
would love to see your evidence.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

<St*************@IDX.COM> wrote in message
news:#f**************@TK2MSFTNGP12.phx.gbl...
In ASP classic, the session onend event was very unreliable. Is this not the case in .NET? Thanks


Define "unreliable."

Sessions in ASP would time out after an interval of inactivity (no

requests
from browser). ASP.Net behaves the same way. But you could and can

always > be
certain of one thing: Sessions end. When they end, the Session_End Event
Handler is called. Is that reliable enough for you?

In classic ASP, Sessions certainly ended. But the Session_OnEnd event did
NOT always fire. That is what I meant by unreliable.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

<St*************@IDX.COM> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...
>
> "Harry" <Ha************@hotmail.com> wrote in news:#LVbPOUiEHA.1040
> @TK2MSFTNGP09.phx.gbl:
>
> > Any solution for this kind of
> > situation?
>
> Look at the Global.asax file. There are several event handlers you can > use... such as On Session End. On session end is executed when the
session
> times out - generally 20 minutes.
>
In ASP classic, the session onend event was very unreliable. Is this not the case in .NET? Thanks

>
> --
> Lucas Tam (RE********@rogers.com)
> Please delete "REMOVE" from the e-mail address when replying.
> http://members.ebay.com/aboutme/coolspot18/
>


Nov 18 '05 #13
"Harry" <Ha************@hotmail.com> wrote in news:eyJ2mgUiEHA.2908
@TK2MSFTNGP10.phx.gbl:
when the user closes the IE by clicking the X mark on the title bar,
Session_End routine is not getting triggered.
Am I doing something wrong?


Session_End gets triggered when the Session Times Out - not when the user
closes IE.

I believe the default Session Time out is 20 minutes.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #14
"Harry" <Ha************@hotmail.com> wrote in news:uArNXrUiEHA.1524
@TK2MSFTNGP10.phx.gbl:
so what is the conclusion? Is there any I can handle it?


Use Session_End - just be paitent and wait for the session to timeout.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #15
I am not the only one to contend this. Check out

http://www.aspfaq.com/show.asp?id=2078

This is a fairly common conversation over at ...inetserver.asp.general. I
do not know if it still applies.

Long ago, I ran a test to track the firing of Session_OnEnd. I no longer
have access to this test since it was 2 jobs ago. But it was clear that
when the session expired, the event did not always fire. I wish I had
better evidence than that for you, but unfortunately I do not.

Now, as for the faq article, I never even considered using recordsets and
whatnot at session scope for a host of reasons, and this consideration
never even entered my mind.

Stephanie

I started using ASP when it first came out. In all these years I have > never heard anyone claim that the Session_End event would not fire every > time. I would love to see your evidence.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

<St*************@IDX.COM> wrote in message
news:#f**************@TK2MSFTNGP12.phx.gbl...
> In ASP classic, the session onend event was very unreliable. Is > this
not
> the case in .NET? Thanks

Define "unreliable."

Sessions in ASP would time out after an interval of inactivity > (no

requests
from browser). ASP.Net behaves the same way. But you could and > can

always > be
certain of one thing: Sessions end. When they end, the > Session_End
Event Handler is called. Is that reliable enough for you?

In classic ASP, Sessions certainly ended. But the Session_OnEnd >

event did NOT always fire. That is what I meant by unreliable.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

<St*************@IDX.COM> wrote in message
news:O8**************@tk2msftngp13.phx.gbl...
> >
> > "Harry" <Ha************@hotmail.com> wrote in > news:#LVbPOUiEHA.1040 > > @TK2MSFTNGP09.phx.gbl:
> >
> > > Any solution for this kind of
> > > situation?
> >
> > Look at the Global.asax file. There are several event > handlers you
can
> > use... such as On Session End. On session end is executed > when
the > session
> > times out - generally 20 minutes.
> >
>
>
> In ASP classic, the session onend event was very unreliable. Is >

this not
> the case in .NET? Thanks
>
>
>
> >
> > --
> > Lucas Tam (RE********@rogers.com)
> > Please delete "REMOVE" from the e-mail address when replying.
> > http://members.ebay.com/aboutme/coolspot18/
> >

Nov 18 '05 #16
St*************@IDX.COM wrote in
news:uZ**************@tk2msftngp13.phx.gbl:
http://www.aspfaq.com/show.asp?id=2078

This is a fairly common conversation over at
...inetserver.asp.general. I do not know if it still applies.

Long ago, I ran a test to track the firing of Session_OnEnd. I no
longer have access to this test since it was 2 jobs ago. But it was
clear that when the session expired, the event did not always fire. I
wish I had better evidence than that for you, but unfortunately I do
not.


Were you testing on IIS 5.0? Like the FAQ says, the reliablity problems
with IIS have been fixed since v5.0. I know Session End was a problem with
older versions of IIS, but I haven't heard of any compaints on v5.0 or
v6.0.

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 18 '05 #17
In ASP classic. it was not possible to do database ops in the Session_OnEnd
event handler. However, in ASP.Net, it certainly is.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

<St*************@IDX.COM> wrote in message
news:uZ**************@tk2msftngp13.phx.gbl...
I am not the only one to contend this. Check out

http://www.aspfaq.com/show.asp?id=2078

This is a fairly common conversation over at ...inetserver.asp.general. I
do not know if it still applies.

Long ago, I ran a test to track the firing of Session_OnEnd. I no longer
have access to this test since it was 2 jobs ago. But it was clear that
when the session expired, the event did not always fire. I wish I had
better evidence than that for you, but unfortunately I do not.

Now, as for the faq article, I never even considered using recordsets and
whatnot at session scope for a host of reasons, and this consideration
never even entered my mind.

Stephanie

I started using ASP when it first came out. In all these years I have >

never
heard anyone claim that the Session_End event would not fire every >

time. I
would love to see your evidence.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

<St*************@IDX.COM> wrote in message
news:#f**************@TK2MSFTNGP12.phx.gbl...
> > In ASP classic, the session onend event was very unreliable. Is > this not
> > the case in .NET? Thanks
>
> Define "unreliable."
>
> Sessions in ASP would time out after an interval of inactivity > (no
requests
> from browser). ASP.Net behaves the same way. But you could and > can
always > be
> certain of one thing: Sessions end. When they end, the > Session_End Event > Handler is called. Is that reliable enough for you?
>
In classic ASP, Sessions certainly ended. But the Session_OnEnd > event did NOT always fire. That is what I meant by unreliable.

> --
> HTH,
> Kevin Spencer
> ..Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> <St*************@IDX.COM> wrote in message
> news:O8**************@tk2msftngp13.phx.gbl...
> > >
> > > "Harry" <Ha************@hotmail.com> wrote in > news:#LVbPOUiEHA.1040 > > > @TK2MSFTNGP09.phx.gbl:
> > >
> > > > Any solution for this kind of
> > > > situation?
> > >
> > > Look at the Global.asax file. There are several event > handlers you can
> > > use... such as On Session End. On session end is executed > when the > > session
> > > times out - generally 20 minutes.
> > >
> >
> >
> > In ASP classic, the session onend event was very unreliable. Is > this not
> > the case in .NET? Thanks
> >
> >
> >
> > >
> > > --
> > > Lucas Tam (RE********@rogers.com)
> > > Please delete "REMOVE" from the e-mail address when replying.
> > > http://members.ebay.com/aboutme/coolspot18/
> > >
>

Nov 18 '05 #18
note: the Session On End event only fires for inproc session managers.

-- bruce (sqlwork.com)
"Kevin Spencer" <ks******@takempis.com> wrote in message
news:OR*************@TK2MSFTNGP11.phx.gbl...
In ASP classic. it was not possible to do database ops in the Session_OnEnd event handler. However, in ASP.Net, it certainly is.

--
HTH,
Kevin Spencer
.Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

<St*************@IDX.COM> wrote in message
news:uZ**************@tk2msftngp13.phx.gbl...
I am not the only one to contend this. Check out

http://www.aspfaq.com/show.asp?id=2078

This is a fairly common conversation over at ...inetserver.asp.general. I do not know if it still applies.

Long ago, I ran a test to track the firing of Session_OnEnd. I no longer
have access to this test since it was 2 jobs ago. But it was clear that
when the session expired, the event did not always fire. I wish I had
better evidence than that for you, but unfortunately I do not.

Now, as for the faq article, I never even considered using recordsets and whatnot at session scope for a host of reasons, and this consideration
never even entered my mind.

Stephanie

I started using ASP when it first came out. In all these years I have
never
heard anyone claim that the Session_End event would not fire every >

time. I
would love to see your evidence.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

<St*************@IDX.COM> wrote in message
news:#f**************@TK2MSFTNGP12.phx.gbl...
> > > In ASP classic, the session onend event was very unreliable. Is

this
> not
> > > the case in .NET? Thanks
> >
> > Define "unreliable."
> >
> > Sessions in ASP would time out after an interval of inactivity > (no > requests
> > from browser). ASP.Net behaves the same way. But you could and > can > always > be
> > certain of one thing: Sessions end. When they end, the >

Session_End Event
> > Handler is called. Is that reliable enough for you?
> >
>
>
> In classic ASP, Sessions certainly ended. But the Session_OnEnd >

event did
> NOT always fire. That is what I meant by unreliable.
>
> > --
> > HTH,
> > Kevin Spencer
> > ..Net Developer
> > Microsoft MVP
> > Big things are made up
> > of lots of little things.
> >
> > <St*************@IDX.COM> wrote in message
> > news:O8**************@tk2msftngp13.phx.gbl...
> > > >
> > > > "Harry" <Ha************@hotmail.com> wrote in >

news:#LVbPOUiEHA.1040
> > > > @TK2MSFTNGP09.phx.gbl:
> > > >
> > > > > Any solution for this kind of
> > > > > situation?
> > > >
> > > > Look at the Global.asax file. There are several event >
handlers you
> can
> > > > use... such as On Session End. On session end is executed >
when the
> > > session
> > > > times out - generally 20 minutes.
> > > >
> > >
> > >
> > > In ASP classic, the session onend event was very unreliable. Is

this
> not
> > > the case in .NET? Thanks
> > >
> > >
> > >
> > > >
> > > > --
> > > > Lucas Tam (RE********@rogers.com)
> > > > Please delete "REMOVE" from the e-mail address when replying.
> > > > http://members.ebay.com/aboutme/coolspot18/
> > > >
> >


Nov 18 '05 #19
use javascript xmlHttp object and execute that file on the server what ever
operation u want to do.Call that javascript method on bodt unload

"Harry" wrote:
My development environment is Framework 1.1, ASP.Net and IE 6.X.

I have logout button in all the screens in the application. I am doing
database activity when the user clicks on logout button. However the user
can close the application using the IE close cross mark. When the user
closes the application without logout button all my database routine and
logout activities will not be called. Any solution for this kind of
situation? Thanks for your thoughts.

Harry

Nov 18 '05 #20
Hi Harry:
I apologize in advance if this is not what you are looking for, but I was
browsing the msdn site for a class and came across your posting and may have
an answer for you.

I use ASP - The following skeleton of code is executed when someone moves
off the current page. It needs some coding to check for navigating away from
your application or just to another page within it, but hopefully this will
be helpful.

Saw this code on a site a while ago and I've been using it ever since to log
out users on my site.
:) -Andrew

<script language="vbscript">
Function window_onbeforeunload()
Dim myChoice
' Code here to check if page going to is an outside page.

myChoice = Msgbox("You are still logged in. Would you like to log out?" &
vbcr & vbcr & "Click 'Yes' to close your session." & _
vbcr & "Click 'No' to continue but keep your session active." & vbcr & _
"Click 'Cancel' and you will be able to remain by choosing 'Cancel' in the
next message box that appears.", vbyesnocancel, "Logout?")
Select Case myChoice
Case vbyes
' Logout Code Here

Case vbno
'Do Nothing, window will navigate away and session will remain active.
Case vbCancel
window_onbeforeunload = "Click Cancel to remain."
Case Else:
window_onbeforeunload = "Click Cancel to remain."
End Select
End Function
</script>
"Harry" wrote:
My development environment is Framework 1.1, ASP.Net and IE 6.X.

I have logout button in all the screens in the application. I am doing
database activity when the user clicks on logout button. However the user
can close the application using the IE close cross mark. When the user
closes the application without logout button all my database routine and
logout activities will not be called. Any solution for this kind of
situation? Thanks for your thoughts.

Harry

Nov 18 '05 #21

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Al Fraser | last post by:
Hope someone can help. My situation is this: I have x number of ASPs that form a 'sales process'. What I want to be able to do is detect when the user has left our 'sales process' (so I can...
2
by: ho0c1355 | last post by:
Hi, I was wondering anyone can help me? I am looking for a javascript that can do such a thing? If the Mouse and keyboard sit and do nothing for 5 to 10 minutes. The Internet Browser will close...
4
by: Champika Nirosh | last post by:
Hi All, I have a asp .net app and it is a online test application so tracking the user behaviour is very important. The problem is in what way I can identify the user logoff time if it happens...
3
by: Denon | last post by:
How to trap browser close event in SERVER side? I read a lot of forum message, it talk about onclose(), onunload() and even onbeforeunload() event. However, all of theses are based on javascript...
2
by: Sunil Sabir | last post by:
Dear All, I have a Main Asp.Net page . In that Page I have a Tab Strip which has SIX tabs each representing a different web Forms.So that when a user clicks different tab he can navigate between...
3
by: Lord2702 | last post by:
Sat. Oct. 30, 2004 3:25 PM PT I want to detect, if user has close the browser, (after logging to my site), that user has closed the browser. How to achieve it ? I want to know this close action...
4
by: mammen | last post by:
Hello, I'm writing trace log of various actions happening in my ASP.NET web application by opening a text file when the user logs in to the system and closing the file while the user logs out....
1
by: bloodandrose | last post by:
Can you help me How to detect browser close event? Thanks
1
by: sreedhardasi | last post by:
Hi, I would like to call a javascript function when user clicks on browser's close button. Here is the scenario. 1. User clicks browser close button. 2. User will be displayed a popup or a...
0
by: rehanrana | last post by:
I built application in VB6, my application appear in system tray, when I double click on icon of my application, it run screen saver, my screen saver shows images and news. Screen saver...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.