Click here to Skip to main content
15,908,172 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
how can i implement case sensitive property in login form in case of password match from database of sql server in my project of asp.net with c#. I need also the code .
Posted
Comments
Manfred Rudolf Bihy 26-May-11 4:49am    
"Case sensitive property" ???
C# is case sensitive, what are you on about?
Sergey Alexandrovich Kryukov 26-May-11 15:24pm    
I guess it's not about property but its value. No matter, the string type is "case-sensitive". The only question would be how to make it case-insensitive.
--SA
parmar_punit 26-May-11 5:01am    
use Equals() method to compare two string... it is more secure.....
if(textbox1.Text.Equals("your Value")) // it is case-sensitive, its return true if all char is matched with its case....
Sergey Alexandrovich Kryukov 26-May-11 15:22pm    
No! Equals can be used, but it's even type-agnostic. How it can be "more secure"? Is you thinks as an example where the "less secure" fails and Equals work -- you won't!
There is nothing better than "==".
--SA

1 solution

If you are actually checking the password against the database, you can use the CompareOptions[^] property in the string.Compare method[^]. Try by setting the value to None.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 26-May-11 15:25pm    
...which will be equivalent to using default string comparison which is already case-sensitive ("=="), right?
My 5.
--SA
Abhinav S 27-May-11 0:26am    
Thank you SA.

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