I am using Asp.Net Webforms application. I used Microsoft.AspNet.Identity for authentication. I want use user's email address as username. But it doesn't let. can you help me please?
Asked
Active
Viewed 2,053 times
0
-
Can you provide the error, context? – nphx Nov 24 '13 at 18:08
-
the error is "User name is invalid, can only contain letters or digits." – user3013083 Nov 24 '13 at 18:16
-
public AccountController(UserManager
userManager) { UserManager = userManager; var userValidator = UserManager.UserValidator as UserValidator – user3013083 Nov 24 '13 at 18:17; userValidator.AllowOnlyAlphanumericUserNames = false; } -
this one is the way that I can solve this problem. But it is for MVC and I dont know how can I use this in Webforms application – user3013083 Nov 24 '13 at 18:17
-
I dont use MVC and I dont have AccountController. – user3013083 Nov 24 '13 at 18:24
1 Answers
5
Probably the problem is the use of non-alphanumeric characters in username. If so use this
UserManager.UserValidator = new UserValidator<TUser>(UserManager) {
AllowOnlyAlphanumericUserNames = false }

Christian Phillips
- 18,399
- 8
- 53
- 82

Hessam
- 1,377
- 1
- 23
- 45
-
-
@user3013083 Add this code to the constructor of public AccountController(UserManager
userManager) – Hessam Nov 24 '13 at 19:17 -
1
-
-
1@user3013083 Who the f' still uses asp.net Webforms? It's complete junk. – The Muffin Man Feb 09 '14 at 01:03