1

this code use Authentication person for login ,my problem is in password for example if

pass=AAaa and we enter aaaa login in system ,what to do for case sensitive in search?

Inspector inspector = context.Inspectors.Where(i => i.InspectorUserName == userName

                && i.InspectorPssWord == passWord).FirstOrDefault();

thanks

kmatyaszek
  • 19,016
  • 9
  • 60
  • 65
Aftab Garm
  • 175
  • 1
  • 3
  • 9
  • 3
    Did you try it? because I would say this is already checking case sensitive. PS: shouldn't you encrypt the passwords and compare the hashes instead? – bas Mar 26 '13 at 20:03
  • this question is dublicated. original question and answer is [here][1] [1]: http://stackoverflow.com/questions/841226/case-insensitive-string-compare-in-linq-to-sql – Nuri YILMAZ Mar 26 '13 at 20:04
  • The problem is most likely your DB is doing a case-insensitive search. If you're using SQL Server, see http://stackoverflow.com/a/3054977/310574 for making that field case-sensitive. – Gabe Mar 26 '13 at 20:25
  • Is this a L2S or EF scenario? – Marc L. Mar 26 '13 at 20:25

1 Answers1

6

Linq (and C# for that matter) already does case sensitive checks, so you don't have to modify your code to include that.

On another note though, you should really hash those passwords :)

Mathew Thompson
  • 55,877
  • 15
  • 127
  • 148