Results 1 to 15 of 15

Thread: How do you verify a password with upper and lower case?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    101

    How do you verify a password with upper and lower case?

    I know how to verify a password that is the exact words but I don't know how to verify a password with upper and lower case to it.

    What is some of the method to get this done?

    Thanks!

    Don

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    101

    Re: How do you verify a password with upper and lower case?

    This would be relating to what is shown in the database, not confirming between two textbox(Password and Confirm Password)

  3. #3
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: How do you verify a password with upper and lower case?

    What server you are using

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    101

    Re: How do you verify a password with upper and lower case?

    Window 2000 server and Windows XP for development testing.

    What does this has to do with the server? I don't understand.

  5. #5
    Addicted Member rabid lemming's Avatar
    Join Date
    Feb 2005
    Posts
    210

    Smile Re: How do you verify a password with upper and lower case?

    Ummm...maybe I’m wrong but could you not just add this

    .ToString.ToLower

    so it be like

    if UserName.ToString.ToLower = DataBaseUserName.ToString.ToLower then ....

    That way if the database or textbox, entry had a string with either upper, lower or both case type letters; the code would make them the same case for a compression

    That’s just an idea like. If you wanted to make it so the user had to have a user name who's letter were the exsact same case as one in a data base to mach i.e. “MyPasSWoRD” would have to be like that to mach the database to be allowed, then would it not just be an exact string match ?

    I will wait for death with a smile and a big stick

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    101

    Re: How do you verify a password with upper and lower case?

    Quote Originally Posted by rabid lemming
    That’s just an idea like. If you wanted to make it so the user had to have a user name who's letter were the exsact same case as one in a data base to mach i.e. “MyPasSWoRD” would have to be like that to mach the database to be allowed, then would it not just be an exact string match ?
    yeah, that what I thought too but it didn't work. I'm using MS Access for the web application.

  7. #7
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: How do you verify a password with upper and lower case?

    If you are doing the comparison in the database itself, the database is by default not case sensitive. You would have to load it in to a local (to the program itself) variable and then do the comparison in the program.

    However, you aren't storing passwords in plain text in your database are you? ARE YOU?

    o_O
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  8. #8
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How do you verify a password with upper and lower case?

    Quote Originally Posted by tripnotic
    I know how to verify a password that is the exact words but I don't know how to verify a password with upper and lower case to it.

    What is some of the method to get this done?

    Thanks!

    Don
    You shouldn't have to, and shouldn't.

  9. #9

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    101

    Re: How do you verify a password with upper and lower case?

    Quote Originally Posted by Lord_Rat
    If you are doing the comparison in the database itself, the database is by default not case sensitive. You would have to load it in to a local (to the program itself) variable and then do the comparison in the program.

    However, you aren't storing passwords in plain text in your database are you? ARE YOU?

    o_O
    This is what I do:
    objCmd = new OleDbCommand("SELECT * FROM Employees WHERE Username='" + strUsername + "' AND Password='" + strPassword + "'", objConn);

    return true if there is any record found. Am I checking the password wrong?


    Plain text as in the data type set as TEXT? if so, then Yes.

    Quote Originally Posted by mendhak
    You shouldn't have to, and shouldn't.
    what do you mean by I shouldn't?

  10. #10
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How do you verify a password with upper and lower case?

    Quote Originally Posted by tripnotic
    what do you mean by I shouldn't?

    It implies that you're storing the passwords as plaintext in your database. (Which is bad)

    Second, you're creating inline SQL statements which are open to SQL injection attacks. (Which is bad)

    Third, passwords should be case sensitive anyways, but you're looking to match the passwords up no matter the case. (Which is bad)

  11. #11
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: How do you verify a password with upper and lower case?

    Your last part is wrong, Mend. His problem was that he WANTED them to be case sensitive, but they were passing regardless of case.

    Trip, here is the *proper* way of doing passwords:

    Develop a hash. The Cryptographic provider of .Net makes doing so much less of a pain than it used to be.

    When a user sets up a password for the first time, hash it against your internal cryptographic provider and then store the hash in the database.

    When a user attempts to log in again, read the hash from the database, something like this:

    SELECT Hash FROM tblUserInfo WHERE UserName = @UserName

    You define @UserName using Parameterization (a quick search on these boards should tell you everything you wanted to know about Parameterization)

    Then, you take the hash you read out of the database and compare it to the hash you just generated from their password. If they match, you log them in. If not, you tell them to give their PC to their grandmother and never touch the Internet again.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  12. #12
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How do you verify a password with upper and lower case?

    His first line was confusing enough

  13. #13
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497

    Re: How do you verify a password with upper and lower case?

    But the implied statement of course, is that you were right on the first two points, =)

    And that third eye.... that's something else =)
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  14. #14

    Thread Starter
    Lively Member
    Join Date
    Feb 2006
    Posts
    101

    Re: How do you verify a password with upper and lower case?

    Quote Originally Posted by mendhak
    It implies that you're storing the passwords as plaintext in your database. (Which is bad)

    Second, you're creating inline SQL statements which are open to SQL injection attacks. (Which is bad)

    Third, passwords should be case sensitive anyways, but you're looking to match the passwords up no matter the case. (Which is bad)

    So use store procedure with parameterization to verify login and password rather inline sql statements? Or there is something else you are recommending? The code above is what I learn through a book 2 years ago and didn't learn the right way of verify logins.

    Sorry about confusing you, I was referring to check the password that is case-sensitive but couldn't think of the right term at the time.



    Quote Originally Posted by Lord_Rat
    Trip, here is the *proper* way of doing passwords:

    Develop a hash. The Cryptographic provider of .Net makes doing so much less of a pain than it used to be.
    Thanks! I also learn how to salt the password before hashing it.

  15. #15
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How do you verify a password with upper and lower case?

    Quote Originally Posted by tripnotic
    So use store procedure with parameterization to verify login and password rather inline sql statements?
    Yep, that's what I'm recommending.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width