Hi,
I am new to Form Authentication. I want to check if the username and password is correct, then the user will redirect to Default.aspx otherwise still in Login.aspx
In web.config
<authentication mode="Forms"><forms loginUrl="Login.aspx" defaultUrl="Default.aspx" timeout="1800"></forms></authentication><authorization><deny users="?" /></authorization>
I am not using Login controls. Just place two textbox and button.
In Login.aspx.cs
protected void btnLogin_Click(object sender, EventArgs e)
{
AdminLogin objad = AdminLogin.GetAdminLogin(txtUserName.Text.Trim());
if (objad == null)
{
}
else
{
if (objad.Password == txtPassword.Text.Trim())
{
Response.Redirect("Default.aspx");
}
else
{
Utils.ShowAlert(this,"Invalid Username or Password");
}
}
}But still in Login.aspx If the username and Password is Correct. I need to know How to Configure Authentication in code behind.
Thanks.