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.

Kirtan PatelRank #292 · 8.6K reputationPosted Oct 25, 2009, 10:14 AM EDT
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 ");
}
}
Vandana Sardana48 reputationPosted Oct 25, 2009, 8:53 PM EDT
jingeRank #2,527 · 554 reputationPosted Oct 25, 2009, 10:36 PM EDT
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 Sardana48 reputationPosted Oct 27, 2009, 3:02 AM EDT
avani raval24 reputationPosted Oct 27, 2009, 3:19 AM EDT