小编Dav*_*vid的帖子

尝试访问有效帐户 ASP.NET Core 时出现无效登录尝试

我的 PC 上有 ASP.NET Core 项目,那里的一切都运行良好。

最近,我将 SQL 数据库从 PC 转移到笔记本电脑上,看看如果我将项目发送给某人会发生什么。我有两个数据库,但在这个问题中,我想重点关注存储用户信息的数据库。

当我尝试使用 PC 上的帐户登录时,一切正常,并且我能够登录到我的帐户,但是当我尝试在笔记本电脑上执行相同操作时,我得到的是Invalid Login Attempt,这是检查登录的函数:

public async Task<IActionResult> OnPostAsync(string returnUrl = null)
{
    returnUrl ??= Url.Content("~/");

    ExternalLogins = (await _signInManager.GetExternalAuthenticationSchemesAsync()).ToList();
        
    if (ModelState.IsValid)
    {
        // This doesn't count login failures towards account lockout
        // To enable password failures to trigger account lockout, set lockoutOnFailure: true
        var result = await _signInManager.PasswordSignInAsync(Input.Email, Input.Password, Input.RememberMe, lockoutOnFailure: false);

        if (result.Succeeded)
        {
            _logger.LogInformation("User logged in.");
            return LocalRedirect(returnUrl);
        }

        if (result.RequiresTwoFactor)
        {
            return RedirectToPage("./LoginWith2fa", …
Run Code Online (Sandbox Code Playgroud)

c# asp.net-core asp.net-core-identity

2
推荐指数
1
解决办法
1374
查看次数

标签 统计

asp.net-core ×1

asp.net-core-identity ×1

c# ×1