IIS上具有哈希密码问题的ASP MVC登录

时间:2018-11-27 07:26:39

标签: asp.net asp.net-mvc iis cryptography

对于一个新网站,我正在使用.NET的内置加密功能

第一个问题:一切都在本地运行,但是当我在VPS上发布网站时,由于Crypto.VerifyHashedPassword由于某种原因返回false,所以我无法登录。

我的一些代码:

注册:

        var passwordSalt = Crypto.GenerateSalt(32);

        var accountInfo = new AccountInfo
        {
            FirstName = model.FirstName,
            LastName = model.LastName,
            Email = model.Email,
            Password = Crypto.HashPassword(model.Password + passwordSalt),
            PasswordSalt = passwordSalt,

登录:

        if (Crypto.VerifyHashedPassword(accountInfo.Password, model.Password + accountInfo.PasswordSalt))
                    ModelState.AddModelError(string.Empty, "Deze inloggegevens zijn verkeerd. Probeer opnieuw!");
        };

        var tResult = await accountService.SaveAccountInfoAsync(accountInfo);

我以前使用过它,从来没有任何问题。我的VPS出问题了吗?

0 个答案:

没有答案
相关问题