<authentication mode="Forms">
<forms loginUrl="Login.aspx" timeout="30" defaultUrl="Home.aspx" cookieless="AutoDetect">
<credentials passwordFormat="Clear">
<user name="Shiv" password="pass@123"/>
<user name="Raju" password="pass@123"/>
</credentials>
</forms>
</authentication>
<authorization>
<deny users="?"/>
</authorization>
- protected void btnSubmit_Click(object sender, EventArgs e)
- {
- Page.Validate();
- if (!Page.IsValid) return;
- if (FormsAuthentication.Authenticate(txtUser.Text, txtPass.Text))
- {
- FormsAuthentication.RedirectFromLoginPage(txtUser.Text, false);
- }
- else
- {
- msg.Text = "Invalid Username or Password";
- }
- }
-
private bool Authenticate(string username, string password)
{
// This method authenticates the user for the application.
// In this demonstration application it always returns
// true.
return true;
}
protected void LogOffLinkButton_Click(object sender, System.EventArgs e)
{
FormsAuthentication.SignOut();
Response.Redirect("~/Security/Login.aspx");
}
FormsAuthentication.RedirectFromLoginPage(UserName.Text.Trim(), true);
No comments:
Post a Comment