Click here to Skip to main content
15,910,877 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi,

I have an application with MS-Access as backend.
When i checked entered password with database password, the system ignore cases (let me give an example, actual password is Test but if i type test/TeSt/TEST also it is allowing me to login.)
How to fix this ?

any help ?

here is my code

VB
Try
            cn.Open()
            cmd = New OleDbCommand("select *from Login where uname='" & TextBox4.Text & "' and pwd='" & TextBox3.Text & "'", cn)
            rs = cmd.ExecuteReader
            If rs.HasRows Then
                Session("validated") = True
                Response.Redirect("home.aspx")
            Else
                Label4.Visible = True
                Label4.Text = "Wrong UserName or Password, Try Again!!"
                TextBox3.Focus()
            End If
            cn.Close()
        Catch ex As Exception
            cn.Close()
        End Try
        If TextBox4.Text = "" Then
            Label4.Visible = True
            Label4.Text = "Please Enter UserName"
        ElseIf TextBox3.Text = "" Then
            Label4.Visible = True
            Label4.Text = "Please Enter Password"
            TextBox3.Focus()
        End If
Posted
Updated 15-Jun-11 20:51pm
v3

Post the code where you are comparing the entered value with the DB value. Use "StringComparison" enum in the string.equals method like:
string.Equals("test", "Test", StringComparison.CurrentCulture);
 
Share this answer
 
v2
Fetch password from database with the help of UserName and then compare entered password value with fetched one.
 
Share this answer
 
Comments
Donthi Thirupathi Reddy 16-Jun-11 2:59am    
Thanx, your idea Solved my problem
koolprasad2003 16-Jun-11 3:02am    
well done
[no name] 16-Jun-11 3:00am    
Well said Koolprasad.
koolprasad2003 16-Jun-11 3:03am    
thankx
Don't store password in its original form, ever.

Please see the answers in this discussion (my answer is there, too, but you look at all of the answers): Password saving .NET[^].

—SA
 
Share this answer
 
Comments
koolprasad2003 16-Jun-11 6:46am    
Good one

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900