这是 Controller
public ActionResult login(login ob)
{
bool mm = db.regs.Any(model => model.username == ob.username && model.password.Equals(ob.password));
if (mm)
{
return RedirectToAction("welcome");
}
else
{
@ViewBag.err = "Invaid";
}
return View();
}
Controller 中的错误是
Unable to create a constant value of type 'System.Object'. Only primitive types or enumeration types are supported in this context.
最佳答案
使用==
而不是等于
model.password == ob.password
关于c# - 如何在 C# 中调试 "Unable to create a constant value of type ' System.Object'"?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38429777/