Is there any code possible in the *.CS file when the user clicks the "X" button on his browser? The X button on browser is the standard Windows button on the top right corner. I want to direct the user to a page (say logout.aspx) when the user clicks this button
after he comes to our web site. I would like to avoid the java script for two reasons: 1) I am not very good with JS and 2) SmartNavigation, which is life blood of my application, fails when I insert JS code and vice versa.
Any ideas? Thanks a lot.
When the user clicks the close button on the browser, you can forget about enough time to redirect to the logout page. And on top of that, there is no way you can stop the window from closing. I have tried this once before on a ASP classic chat and it does
not work at all! Trust me on this one.
Well,... If you are using IE anyway, there is a way. I'm not sure I even want to post it here because it is so obnoxious I would consider it a bug, in a sense. It shouldn't be allowed. function dosomethingincrediblyobnoxious() { window.open("thispage.aspx")
window.open("thispage.aspx") window.open("thispage.aspx") window.open("thispage.aspx") } If you do this, you can't alt/F4 fast enough to close all the windows, it is really obnoxious. This would be a great way of keeping people from ever coming back to your
site.
That does not only apply to closing windows only - when you navigate to another part in your web site, the pop-up window will display... now tell me it does look un-proffesional if you are having pop-up windows displaying a log out button whenever you navigate
to another page. It is not called pushing away the user: it is called telling the user's marching orders!
You probably want to write some logout code or cleaning code when user clicks the "X" button of the browser. I will suggest that you should look for the "Session_End" event of the "Global.asax.vb". This event will fire when the session expire. You can put your
logout or other cleaning code in this event.
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
' Fires when the session ends
End Sub
HelpWanted
Participant
805 Points
161 Posts
Server Side Code for "X" button of Browser?
Aug 01, 2003 07:35 PM|LINK
jlovell
Member
670 Points
134 Posts
Re: Server Side Code for "X" button of Browser?
Aug 01, 2003 08:16 PM|LINK
rl711
Participant
825 Points
165 Posts
Re: Server Side Code for "X" button of Browser?
Aug 01, 2003 09:07 PM|LINK
jlovell
Member
670 Points
134 Posts
Re: Server Side Code for "X" button of Browser?
Aug 02, 2003 06:26 AM|LINK
firoz.ansari
Contributor
3515 Points
694 Posts
Re: Server Side Code for "X" button of Browser?
Aug 03, 2003 12:11 AM|LINK
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the session ends End Sub