Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Posted

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;
   }

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Posted

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

Posted

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.

~Nate�

___________________________________________

Please use the [vb]/[cs] tags on posted code.

Please post solutions you find somewhere else.

Follow me on Twitter here.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...