in Aspx Page ....
<html>
<head>
</head>
<body onunload="LogoutInformation();">
<script type="text/javascript" language="javascript">
function LogoutInformation() {
PageMethods.deleteRecord();
}
</script>
</body>
</html>
<asp:ScriptManager ID="ScriptManager1" runat="server" enablepagemethods="true">
</asp:ScriptManager>
in Code Behind Page (i.e C#)
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public static void LogoutInformation()
{
try
{
HttpContext.Current.Session.Abandon();
}
catch (Exception ex)
{
}
}
Even if you are using Master Page , you can also write above HTML Content under the Asp content Page. Please find the following Example
<asp:Content ID="Content3" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<html>
<head>
</head>
<body onunload="LogoutInformation();">
<script type="text/javascript" language="javascript">
function LogoutInformation() {
PageMethods.deleteRecord();
}
</script>
</body>
</html>
<br />
<asp:ScriptManager ID="ScriptManager1" runat="server" enablepagemethods="true">
</asp:ScriptManager>
</asp:Content>
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment