in CustomSecuritySample/Logon.aspx.cs [102:142]
private void ServerBtnLogon_Click(object sender,
System.EventArgs e)
{
bool passwordVerified = false;
try
{
passwordVerified =
AuthenticationUtilities.VerifyPassword(TxtUser.Text,TxtPwd.Text);
if (passwordVerified)
{
FormsAuthentication.RedirectFromLoginPage(
TxtUser.Text, false);
}
else
{
Response.Redirect("logon.aspx");
}
}
catch(Exception ex)
{
lblMessage.Text = string.Format(CultureInfo.InvariantCulture, ex.Message);
return;
}
if (passwordVerified == true )
{
// The user is authenticated
// At this point, an authentication ticket is normally created
// This can subsequently be used to generate a GenericPrincipal
// object for .NET authorization purposes
// For details, see "How To: Use Forms authentication with
// GenericPrincipal objects
lblMessage.Text = string.Format(CultureInfo.InvariantCulture,
Logon_aspx.LoginSuccess);
BtnRegister.Enabled = false;
}
else
{
lblMessage.Text = string.Format(CultureInfo.InvariantCulture,
Logon_aspx.InvalidUsernamePassword);
}
}