c# - 方法“登录”没有重载需要 4 个参数
问题描述
我在我的AccountModels
. 我还添加了一个属性角色(下拉列表的值为“Admin”和“User”)。现在它显示一些错误
方法“登录”没有重载需要 4 个参数
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public ActionResult Login(LoginModel model, string returnUrl)
{
if (ModelState.IsValid &&
WebSecurity.Login(model.UserName,
model.Password,
model.Role,
persistCookie: model.RememberMe))
{
return RedirectToLocal(returnUrl);
}
}
我该如何解决这个问题?
解决方案
登录的语法是WebSecurity.Login(userName, password, persistCookie)
. 您正在尝试传递 4 个参数
推荐阅读
- r - 数据表:根据第一行和最后一行共享列值的间隔进行分组
- python - 使用 django 在 sqlite 中存储和检索整数列表
- android - 如何修复Android中的UnityPlayerActivity从其他模块请求权限?
- prolog - 一个易于实现的 prolog 图形界面
- r - 如何将函数参数传递给 R 模型对象
- excel - 打印宏疑难解答
- angular - 无法在 Angular 7 项目中加载 Bootstrap 4.2.1 样式
- c# - 给游戏对象速度/速度并转换向量点
- python - 如何拆分列表中值的重复计数并显示实际值?
- spring - 在测试期间替换具有 Autowired 依赖项的 Spring bean