The text of this article is not in this database — only its details are. Read it on the old site: How to use Login Control in Visual Studio 2005
4 Comments
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
The text of this article is not in this database — only its details are. Read it on the old site: How to use Login Control in Visual Studio 2005
Join the conversation! Your thoughts help the community grow.
Sign in to leave a comment.
Abhinav SinghPosted Dec 18, 2010, 1:16 AM
This code works for only first entry in database. By returning bool value outside the while loop it is working fine
Gaopalelwe BaikgakiPosted Oct 6, 2009, 2:29 AM
Hi id like to know if you have a tutorial which shows how to make a new member to register and also for the site to remember how many times the person has visited the site?
jasmine banuPosted Jul 13, 2007, 6:20 AM
Hi i try this code. It build successfully. but when running it throws exception like this. (Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.) I don't know how to tackle this. Will anyone help me?
aspeditedPosted Apr 11, 2007, 10:27 PMEdited Apr 11, 2007, 10:40 PM
Hi i try the code u post, i dont get any error but i failed to login thru the login control it says "Your login attempt was not successful. Please try again." But the id & password are correct... protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { bool Authenticated = false; Authenticated = SiteLevelCustomAuthenticationMethod(Login1.UserName, Login1.Password); e.Authenticated = Authenticated; if (Authenticated == true) { Response.Redirect("Default3.aspx"); } } private bool SiteLevelCustomAuthenticationMethod(string UserName, string Password) { bool boolReturnValue = false; SqlConnection Connection = new SqlConnection(@"server=SQLEXPRESS; database=Test; uid=a; pwd=a;"); String strSQL = "Select * From tblLogin"; SqlCommand command = new SqlCommand(strSQL, Connection); Connection.Open(); SqlDataReader Dr = command.ExecuteReader(); while (Dr.Read()) { if ((UserName == Dr["id"].ToString()) & (Password == Dr["pswd"].ToString())) boolReturnValue = true; } Dr.Close(); return boolReturnValue; } Please help me.... Thank You in advance