如何使用 dbContext 和 MySQL 数据库登录 MVC Web 应用程序

问题描述 投票:0回答:1

我有一个使用 MVC 和 MySql 作为数据库的 Web 应用程序。如何创建登录表单,但我不知道如何使用

DbContext
登录。我试过了,但没用:

[HttpPost]
public ActionResult Login(AccountModel objAccount)
{
    if(objMyDbContext.ObjAccountModel.ToList().Count==1) return RedirectToAction("Index", "Home");
    return RedirectToAction("Login", "Account");
}
c# mysql asp.net-mvc
1个回答
1
投票

您可以使用

IdentityUser
signInManager
提供内置登录支持。

© www.soinside.com 2019 - 2024. All rights reserved.