468,110 Members | 1,832 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,110 developers. It's quick & easy.

end session when the browser window is closed.

sun
I want to do clean up routine to my database when the browser is closed. I
have my code in session-end - but it never fires when the browser closes. I
cant do onbeforeunload as it will be fired each time when the browser posts
back.
Somehow I want to capture browser close event and fire session abandon which
will call session end. Please help.
Thanks,
Sun
Nov 19 '05 #1
8 11256
Hi Sun,

I don't beleive you can "reliably detect" a browser closing.
Have you tried employing some type of session timeout which would fire
the session end?

Nov 19 '05 #2
Consider using HttpResponse.IsClientConnected property.

Eliyahu

"sun" <su*@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.com...
I want to do clean up routine to my database when the browser is closed. I have my code in session-end - but it never fires when the browser closes. I cant do onbeforeunload as it will be fired each time when the browser posts back.
Somehow I want to capture browser close event and fire session abandon which will call session end. Please help.
Thanks,
Sun

Nov 19 '05 #3
sun
How or where do I have to use HttoResponse.IsClientConnected property
Sun

"Eliyahu Goldin" wrote:
Consider using HttpResponse.IsClientConnected property.

Eliyahu

"sun" <su*@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.com...
I want to do clean up routine to my database when the browser is closed.

I
have my code in session-end - but it never fires when the browser closes.

I
cant do onbeforeunload as it will be fired each time when the browser

posts
back.
Somehow I want to capture browser close event and fire session abandon

which
will call session end. Please help.
Thanks,
Sun


Nov 19 '05 #4
Start from googling newsgroups to see how other people use it. I don't have
personal experience with it, that's why I put a careful "Consider" in my
post. Could be it doesn't help at all. Consider it. Make your own research.

Eliyahu

"sun" <su*@discussions.microsoft.com> wrote in message
news:31**********************************@microsof t.com...
How or where do I have to use HttoResponse.IsClientConnected property
Sun

"Eliyahu Goldin" wrote:
Consider using HttpResponse.IsClientConnected property.

Eliyahu

"sun" <su*@discussions.microsoft.com> wrote in message
news:5E**********************************@microsof t.com...
I want to do clean up routine to my database when the browser is
closed. I
have my code in session-end - but it never fires when the browser
closes. I
cant do onbeforeunload as it will be fired each time when the browser

posts
back.
Somehow I want to capture browser close event and fire session abandon

which
will call session end. Please help.
Thanks,
Sun


Nov 19 '05 #5
> Somehow I want to capture browser close event and fire session abandon
which
will call session end. Please help.


I think you are missing a trick. The behaviour is a feature. I think users
can close thier browser and then reconnect to thier session if it was an
accident.

What do you have to clear out? Have you got a lot of data in the session?
Nov 19 '05 #6
My personal preference is to not tied clean up to the normal application
flow. I tend to prefer to have a dedicated clean up routine that cleans
whatever needs to be cleaned.

You could use onbeforeclose but it's likely you'll find cases where it
doesn't fire (such as crashed browser etc...) plus session_end don't work
for other session providers etc...

Patrice

--

"sun" <su*@discussions.microsoft.com> a écrit dans le message de
news:5E**********************************@microsof t.com...
I want to do clean up routine to my database when the browser is closed. I have my code in session-end - but it never fires when the browser closes. I cant do onbeforeunload as it will be fired each time when the browser posts back.
Somehow I want to capture browser close event and fire session abandon which will call session end. Please help.
Thanks,
Sun

Nov 19 '05 #7
> I think users
can close thier browser and then reconnect to thier session if it was an
accident.

No, they can't, even if it was an accident.
Nov 19 '05 #8
More specifically.. once the parent window and ALL child windows (app
may have used window.open to open other windows under the same session)
have been closed.

Nov 19 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by megha | last post: by
5 posts views Thread by anonmous | last post: by
5 posts views Thread by Ĺženol Akbulak | last post: by
10 posts views Thread by Li Pang | last post: by
3 posts views Thread by Arnost Sobota | last post: by
16 posts views Thread by Jonathan Wood | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.