Trying to create basic authentication in a WebForm .net 4.5 with Individual auth, C#
The system now sort of works, except when you run the Register page, it only asks for EMAIL, PASSWORD, PASSWORD (verify). Why is the UserName stuck as the email? Im so used to MVC world, am just not getting why this wont work. After an email registers,
if I change the username in the table to 'fred' and try to login, it FAILS.
What is needed to add a real UserName entry?
public partial class Register : Page
{
protected void CreateUser_Click(object sender, EventArgs e)
{
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>();
var user = new ApplicationUser() { UserName = Email.Text, Email = Email.Text };
IdentityResult result = manager.Create(user, Password.Text);
if (result.Succeeded)
{
Member
126 Points
878 Posts
Why is the default boilerplate asp.net Register.aspx.cs code force the UserName = email address?
Dec 12, 2018 04:01 PM|rogersbr|LINK
Trying to create basic authentication in a WebForm .net 4.5 with Individual auth, C#
The system now sort of works, except when you run the Register page, it only asks for EMAIL, PASSWORD, PASSWORD (verify). Why is the UserName stuck as the email? Im so used to MVC world, am just not getting why this wont work. After an email registers, if I change the username in the table to 'fred' and try to login, it FAILS.
What is needed to add a real UserName entry?
public partial class Register : Page { protected void CreateUser_Click(object sender, EventArgs e) { var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>(); var signInManager = Context.GetOwinContext().Get<ApplicationSignInManager>(); var user = new ApplicationUser() { UserName = Email.Text, Email = Email.Text }; IdentityResult result = manager.Create(user, Password.Text); if (result.Succeeded) {