FormsAuthentication.SignOut() : FormsAuthentication « Login Security « ASP.Net






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

1.FormsAuthentication.Authenticate (C#)
2.FormsAuthentication.RedirectFromLoginPage (VB)
3.Checking credentials in SQL Server (VB)
4.Checking credentials in SQL Server (C#)
5.assigning a name to the user accessing next pages
6.Hash password
7.Save user account to an XML file