Skip to content

Instantly share code, notes, and snippets.

@pollax
pollax / Startup.cs
Last active February 28, 2016 12:01
Allow + and other non alphanumeric characters in UserName using ASP.NET Core 1.0, Identity 3.0 and Entity Framework Core 1.0
public void ConfigureServices(IServiceCollection services)
{
// (Rest of code removed)
// Note the + added to the string of allowed user name characters
services.AddIdentity<ApplicationUser, IdentityRole>(o => o.User.AllowedUserNameCharacters = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 -._@+")
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
}