Search code examples
model-view-controllerasp.net-membershipcase-sensitivecustom-membershipprovider

Get rid of case sensitive username in custom membership provider


I implemented a custom membership provider in ASP.net MVC, and can't figure out how to make the username non case-sensitive at signin. So, for example, "Solomon" could log in, but "solomon" could not.

My implementation is very bare bones. I basically just wrote code for ValidateUser(), and Change Password().

Thanks for the help!


Solution

  • shimms is halfway there.

    Splitting a logical operation between two 'tiers' is not a sound practice.

    A logical operation should be atomic. So just lower both in the query...

    e.g.

    where Lower(username)=Lower(@username)