0

I am currently developing an user accounts for a Uni project but I've been struggle with the registration. For some reason when I tried to add some validations, authentications and so on, it suddenly stopped working and I can't understand why. I've been following a lot of examples and hand written codes in some places but once I try to create an account I am getting error message. Here is the error I've been receiving:

When is executed and tried to make a registration
and here is the actual code:

    [HttpPost]
    [AllowAnonymous]
    [ValidateAntiForgeryToken]
    public async Task<ActionResult> Register(UserRegister Account)
    {
        if(ModelState.IsValid)
        {
            var user = new UserAccount { UserName = Account.EmailAddress, Email = Account.EmailAddress};
            var result = await UserManager.CreateAsync(user, Account.Password);
            if (result.Succeeded)
            {
                await SignInManager.SignInAsync(user, isPersistent: false, rememberBrowser: false);

                return RedirectToAction("Index", "Home");
            }
            AddErrors(result);
        }
        return View(Account);
    }

if anyone can help me, I would be so happy.

Thank you in advance, Valentin

0 Answers0