on-internet
← Community

UserManager.FindByEmail() returning Null

Stack Overflow ·

I'm trying to implement email address based usernames in AspNet.Identity for MVC5. My application works find as long as there is a registered email/username on the system. I just discovered that if the user does not exist and tries to login an exception gets thrown on Line 72. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 71: //Add this to check if the email was confirmed. Line 72: var userid = UserManager.FindByEmail(model.Email).Id; Here is my code. public async Task<ActionResult> Login(LoginViewModel model, string

Comments

Sign in or sign up to comment and upvote.

No comments yet.