shivanigoturi Posted April 15, 2008 Posted April 15, 2008 Hi , I am working on a web Application..i have a Login Page..I have a problem with the password authentication..the password does not accept "space" in between the password characters but it does not validate the "space" given after the last character of the Password..it does not say invalid login if the space is given after the last character..it redirects me to the next page..i could not fix this issue..please help me with the same Regards ShivaniGoturi Quote
Nate Bross Posted April 15, 2008 Posted April 15, 2008 Could you post the code that is failing? something simple like this would work, no? if((int)Session["loginCount"] > 3) { lblResult.Text = "To many login attempts, please try again in 15 minutes." } else { If(txtUserID.Text == "userID" & txtPassword.Text == "passW0rD") { // redirect login } else { lblResult.Text = "Invalid UserID or Password. Please try again." Session["loginCount"] += 1; } } You could even remove the Session["loginCount"] to make it more simple, like this If(txtUserID.Text == "userID" & txtPassword.Text == "passW0rD") { // redirect login } else { lblResult.Text = "Invalid UserID or Password. Please try again." Session["loginCount"] += 1; } Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
shivanigoturi Posted April 16, 2008 Author Posted April 16, 2008 Thanks for the code..but im working on asp.net not vb...im a novice user please note...extend help for the same... Thanks&Regards ShivaniGoturi Quote
shivanigoturi Posted April 16, 2008 Author Posted April 16, 2008 ds = new DataSet(); da = new SqlDataAdapter("select * from login3 where name='" + TextBox1.Text + "' and pwd='" + TextBox2.Text + "' and role='" + DropDownList1.Text + "'", cn); da.Fill(ds, "login3"); dt = ds.Tables["login3"]; if (dt.Rows.Count != 0 && DropDownList1.Text == "admin") { Response.Redirect("Page2.aspx"); TextBox2.Text = null; } This is the code... Thanks & Regards Shivani Goturi Quote
Nate Bross Posted April 16, 2008 Posted April 16, 2008 Is there a specific error message that you are getting? I'm not sure, you might want to try dt.Rows.Count > 0 since you may end up with a -1 for the Count property if there are no records returned. Quote ~Nate� ___________________________________________ Please use the [vb]/[cs] tags on posted code. Please post solutions you find somewhere else. Follow me on Twitter here.
shivanigoturi Posted April 17, 2008 Author Posted April 17, 2008 ok will try n get back...thanks for the help Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.