<script language="javascript" type="text/javascript"> window.onbeforeunload = WindowCloseHanlder; function WindowCloseHanlder() { alert("ur closing broswer"); PageMethods.AbandonSession(); } </script> <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true"> In the code behind(class file) [WebMethod] public static void AbandonSession() { HttpContext.Current.Session.Abandon(); HttpContext.Current.Application.RemoveAll(); }
window.onbeforeunload = function(e){ var msg = 'Are you sure you want to close?'; e = e || window.event; if(e) e.returnValue = msg; return msg; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)