username case sensitive

Nov 16, 2009 at 10:02 AM



is the username case sensitive?

Apr 28, 2010 at 10:31 PM
Edited Apr 28, 2010 at 10:31 PM

Yes, it is! I have been trying to make the username case insensitive without luck. I am learning as I go with, but I thought the stringComparer on the dictionary object was case insensitive and, thus, searches should also be?  I tried modifying the ValidateUser method as well but can't figure out how to search a dictionary object in Can I please get a short lesson or perhaps a link to wherever the secrets to lie. The microsoft site is not working out for me. 

Thank you!

Apr 30, 2010 at 3:38 PM

I figured out how to make the username case insensitive. I realized that even though I was changing the cs files I had the compiled dll file in my bin so it was just ignoring my App_Code. Also, realized I was making a stupid mistake trying to search a dictionary object so ignore above post. In order to make the user name case insensitive I edited the App_Code/Store/XmlUserStore.cs file. I changed the return string line to:

? Users.Find(delegate(XmlUser user) { return string.Equals(user.UserName, name, StringComparison.OrdinalIgnoreCase); })

This makes a case insensitive comparison and also returns the original case of the login for when you are displaying the user name. I hope I'm not messing up anything by making these changes but so far everything looks to be working the same.