How to use Login Control in Visual Studio 2005
In the recent version of Visual Studio 2005, Microsoft has taken care of a very common functionality of the web applications. In the following article we will see that how to use login control using C#.Net.
The text of this article is not in this database — only its details are. The old site it was published on is gone, but the Internet Archive kept a copy: How to use Login Control in Visual Studio 2005


Abhinav SinghPosted Dec 17, 2010, 8:16 PM EST
This code works for only first entry in database. By returning bool value outside the while loop it is working fine
Gaopalelwe BaikgakiPosted Oct 5, 2009, 10:29 PM EDT
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, 2:20 AM EDT
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, 6:27 PM EDTEdited Apr 11, 2007, 6:40 PM EDT
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