Snippets
Forms Authentication
Default.aspx
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
lbluserName.Text = User.Identity.Name;
}
protected void LogoutClick(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
Response.Redirect("Default.aspx");
}
Login.aspx
protected void LogonClick(object sender, EventArgs e)
{
if (txtUserName.Text == "ajc")
FormsAuthentication.RedirectFromLoginPage("ajc", false);
}
Web.Config
[system.web]
[authorization]
[deny users="?"/]
[/authorization]
[authentication mode="Forms" /]