Designing Secure ASP.NET Applications Forms Authentication Using an XML Users File
The Default.aspx file is the requested, protected resource. It is a simple file that merely displays the string, Hello, plus the recorded e-mail name, and a Signout button.
<%@ Page LANGUAGE = "c#" %>
<html>
<head>
<title>Forms Authentication</title>
<script runat=server>
private void Page_Load ( Object sender, EventArgs e ) {
Welcome.InnerHtml = "Hello, " + Context.User.Identity.Name;
}
private void Signout_Click ( Object sender, EventArgs E ) {
FormsAuthentication.SignOut ( );
Response.Redirect ( "login.aspx" );
}
</script>
<body>
<h3>Using Forms Authentication</h3>
<span id = "Welcome" runat=server/>
<form runat=server>
<input type = "submit" onServerClick = "Signout_Click" Value = "Signout"
runat = "server" /><p>
</form>
</body>
</html>
The Forms Authentication Provider