Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Valid username characters using SQL provider for ASP.NET membership

What are the valid characters for a user name when using the SQL provider for ASP.NET membership?

like image 976
Gary McGill Avatar asked Mar 26 '10 16:03

Gary McGill


1 Answers

It's any character except for commas (,). The only other restriction is your database encoding settings.

You can view the source for the SqlMembershipProvider.CreateUser method, and the aspnet_Membership_CreateUser stored procedure in the database to verify.

Edit, further evidence:

http://msdn.microsoft.com/en-us/library/system.web.security.sqlmembershipprovider.updateuser.aspx

[An exception is thrown if] the UserName property of user is an empty string (""), contains a comma, or is longer than 256 characters.

like image 187
Greg Avatar answered Jan 04 '23 16:01

Greg