Sunday, July 22, 2007

Authentication: Forms Authentication: Code Listing

Code Listing: FormsAuthentication

if(FormsAuthentication.Authenticate(txtUsername.Text, txtPassword.Text))
FormsAuthentication.RedirectFromLoginPage(txtUsername.Text, true);
else
{

txtPassword.Text = “”;

if(System.Convert.ToInt32(ViewState[“Tries”]) >1 )
Response.Redirect(“Denied.htm”);
else
ViewState[“Tries”] = System.Convert.ToInt32(ViewState[“Tries”]) + 1;

}


Authenticate method checks the username and password against the user’s list found in the element of the web.config

No comments: