Password Authentication

shivanigoturi

Newcomer
Joined
Apr 15, 2008
Messages
4
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
 
Could you post the code that is failing?

something simple like this would work, no?

C#:
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

C#:
    If(txtUserID.Text == "userID" & txtPassword.Text == "passW0rD")
    {
        // redirect login
    }
    else
    {
        lblResult.Text = "Invalid UserID or Password. Please try again."
        Session["loginCount"] += 1;
    }
 
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
 
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
 
Is there a specific error message that you are getting?

I'm not sure, you might want to try
C#:
dt.Rows.Count > 0
since you may end up with a -1 for the Count property if there are no records returned.
 
Back
Top