So it looks like there is a timing issue. Does there need to be Await style access to the table?? It gets the records back, the email is in there but it doesnt see it?
protected void Forgot(object sender, EventArgs e)
{
if (IsValid)
{
// Validate the user's email address
var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>();
ApplicationUser user = manager.FindByName(Email.Text);
if (user == null || !manager.IsEmailConfirmed(user.Id))
{
FailureText.Text = "The user either does not exist or is not confirmed.";
ErrorMessage.Visible = true;
return;
}
// F
The Id in user.Id throws a null reference exception.
And manager.FindByName(Email.Text) does not work, it returns null when you can see the results view showing the 2 currently registered users, the email.text matches but the code fails, saying NULL? then drops into the failuretext.text.
Member
126 Points
878 Posts
Re: Why is the default boilerplate asp.net Register.aspx.cs code force the UserName = email addre...
Dec 12, 2018 07:25 PM|rogersbr|LINK
So it looks like there is a timing issue. Does there need to be Await style access to the table?? It gets the records back, the email is in there but it doesnt see it?
protected void Forgot(object sender, EventArgs e) { if (IsValid) { // Validate the user's email address var manager = Context.GetOwinContext().GetUserManager<ApplicationUserManager>(); ApplicationUser user = manager.FindByName(Email.Text); if (user == null || !manager.IsEmailConfirmed(user.Id)) { FailureText.Text = "The user either does not exist or is not confirmed."; ErrorMessage.Visible = true; return; } // F
The Id in user.Id throws a null reference exception.
And manager.FindByName(Email.Text) does not work, it returns null when you can see the results view showing the 2 currently registered users, the email.text matches but the code fails, saying NULL? then drops into the failuretext.text.