Password case sensitive
I am developing a windows application, my database is in MS-Access. I have made one login form and the users who are authorised can login to the application. My problem is that if the user has made his password using lower case then at the login time the user should enter the password in the same format, means if the user enters the password in upper case then the error will be pop up. I mean to say that whatever case the user used while making the password then he/she should enter in the same format at the login time. That means that the password field should be made case sensitive. Please help me out as this is very urgent and important for me.
avani ravalPosted Oct 27, 2009, 7:19 AM
Vandana SardanaPosted Oct 27, 2009, 7:02 AM
jingePosted Oct 26, 2009, 2:36 AM
If you save the user's password directly into the database, then the password will be saved into the database with the exact Case format. When login, just compare the user's input and the string retrieved from the database. If they are equal, then the user is authorized, otherwise not.
If you don't care the case information, then you could compare the password like the following:
Of course, you can also use the ToLowerCase method.
Vandana SardanaPosted Oct 26, 2009, 12:53 AM
Kirtan PatelPosted Oct 25, 2009, 2:14 PM
Below Code compares String with case sensitive .
private void button1_Click(object sender, EventArgs e)
{
string s1 = textBox1.Text.Trim();
string s2 = textBox2.Text.Trim();
if (s1 == s2)
{
MessageBox.Show("String Are Same ");
}
else
{
MessageBox.Show("String are not same ");
}
}