我在AccountModels
中做了一些更改。我还添加了一个属性角色(下拉列表具有值"管理员"和"用户"(。现在它显示一些错误
方法"登录"没有重载需要 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 个参数