Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Feb 29, 2012 12:07 PM by ramiramilu
Member
15 Points
182 Posts
Feb 29, 2012 01:39 AM|LINK
trying to set the Session("userfound") = False, when the current page has been closes or changes ,,
tried unload but it will call the event on page ends, just not as in page changes,
Contributor
4289 Points
883 Posts
Feb 29, 2012 02:51 AM|LINK
Dear User,
Use this javascript function to invoke a button click in the page after the page is closed.
There should be a Hidden button with click event on the server side, where you will set the Session("userfound") = False.
function doUnload() { if (window.event.clientX < 0 && window.event.clientY < 0) { document.getElementByID('HiddenButton').click() } } <body onunload="doUnload()">
2252 Points
478 Posts
Feb 29, 2012 02:54 AM|LINK
try this <script type="text/javascript"> window.onbeforeunload = bunload; function bunload(){ dontleave="Please Use Logout Button ?"; return dontleave; } script>
All-Star
42904 Points
7022 Posts
MVP
Feb 29, 2012 07:50 AM|LINK
Hi,
As far as I know, there is no server side event to detect the client browser close event. But you can detect it at the client side's onbeforeunload method and sends an ajax call.
Please 'Mark as Answer' if this post helps you.
30547 Points
5841 Posts
Feb 29, 2012 08:13 AM|LINK
here....
http://www.dotnetspider.com/resources/30715-Handling-Browser-Close-Event-at-Server-Side.aspx
http://forums.asp.net/p/1153888/1891072.aspx
in clientside...
http://stackoverflow.com/questions/4333152/how-to-detect-browser-close-at-server-side-in-asp-net
Thanks....
95315 Points
14072 Posts
Feb 29, 2012 12:07 PM|LINK
My friend Vijay kodali wrote a blog post on clearing session event on browser close - http://weblogs.asp.net/kodali/archive/2010/04/29/asp-net-session-on-browser-close.aspx
Thanks,
csharp_start...
Member
15 Points
182 Posts
Call an event when page changes or browser closes asp.net
Feb 29, 2012 01:39 AM|LINK
trying to set the Session("userfound") = False, when the current page has been closes or changes ,,
tried unload but it will call the event on page ends, just not as in page changes,
Srikanth Kas...
Contributor
4289 Points
883 Posts
Re: Call an event when page changes or browser closes asp.net
Feb 29, 2012 02:51 AM|LINK
Dear User,
Use this javascript function to invoke a button click in the page after the page is closed.
There should be a Hidden button with click event on the server side, where you will set the Session("userfound") = False.
Srikanth Kasturi
Please "Mark As Answer" if my post serves purpose.
sunilgurjar
Contributor
2252 Points
478 Posts
Re: Call an event when page changes or browser closes asp.net
Feb 29, 2012 02:54 AM|LINK
try this <script type="text/javascript"> window.onbeforeunload = bunload; function bunload(){ dontleave="Please Use Logout Button ?"; return dontleave; } script>read my blog
http://sunilgurjar.blogspot.com/
Ruchira
All-Star
42904 Points
7022 Posts
MVP
Re: Call an event when page changes or browser closes asp.net
Feb 29, 2012 07:50 AM|LINK
Hi,
As far as I know, there is no server side event to detect the client browser close event. But you can detect it at the client side's onbeforeunload method and sends an ajax call.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.salman beher...
All-Star
30547 Points
5841 Posts
Re: Call an event when page changes or browser closes asp.net
Feb 29, 2012 08:13 AM|LINK
Hi,
here....
http://www.dotnetspider.com/resources/30715-Handling-Browser-Close-Event-at-Server-Side.aspx
http://forums.asp.net/p/1153888/1891072.aspx
in clientside...
http://stackoverflow.com/questions/4333152/how-to-detect-browser-close-at-server-side-in-asp-net
Thanks....
Sincerely,
Salman
ramiramilu
All-Star
95315 Points
14072 Posts
Re: Call an event when page changes or browser closes asp.net
Feb 29, 2012 12:07 PM|LINK
My friend Vijay kodali wrote a blog post on clearing session event on browser close - http://weblogs.asp.net/kodali/archive/2010/04/29/asp-net-session-on-browser-close.aspx
Thanks,
JumpStart