FormsAuthentication.SignOut()
<%@ Page %>
<SCRIPT language="C#" runat="server">
private void Logout_Click(object sender, System.EventArgs e)
{
System.Web.Security.FormsAuthentication.SignOut();
Message.Text="You have been logged out.";
Message.Text+="<meta http-equiv=\"Refresh\" content=\"3;URL=http://java2s.com\" />";
}
</SCRIPT>
<HTML>
<HEAD>
<title>Creating a Simple Forms Authentication Logout Page</title>
</HEAD>
<body>
<form id="form1" method="post" runat="server">
<p align="center"><asp:LinkButton ID="Logout" Runat="server" OnClick="Logout_Click">Logout</asp:LinkButton></p>
<p align=center><asp:Literal ID="Message" Runat="server" /></p>
</form>
</body>
</HTML>
Related examples in the same category