Im trying to design a login form that will check against a SQL database to see if the username and password are correct.
Could some one please supply some sample code of how i would do this.
Thanks, Greg
Im trying to design a login form that will check against a SQL database to see if the username and password are correct.
Could some one please supply some sample code of how i would do this.
Thanks, Greg
He need some help with authentication
wx
http://www.asp.net/QuickStart/aspnet/doc/ctrlref/login/default.aspx
Golgot13
Hi.
You can use FormAuthintication class. Below I am including a psude code. Please try
SqlConnection
con = new SqlConnection("connection string"); SqlCommand commnd = new SqlCommand("Select UserName, Password From User Where UserName='Bappi' AND Password='Bappi'");commnd.CommandType =
CommandType.Text;con.Open();
SqlDataReader reader = commnd.ExecuteReader(CommandBehavior.CloseConnection); if (reader.Read()){
FormsAuthentication
.RedirectFromLoginPage("page url", true);}
else{
label1.Text = "Invalid Credential";
}
Try this code.
regards
bp