我有MVC.Net C#登录页面,我决定做一些奇特的更改,突然我的登录页面停止工作。 我需要你的帮助,别人看我的代码,并可能会看到我无法找到。在调试过程中,它将返回所有true,但不会进入索引页面。你怎么看 ?我看不到什么是我的问题!我的登录代码验证我的凭据,但不要登录
这里是我的控制器:
// GET: /Account/Login
[AllowAnonymous]
public ActionResult Login(string returnUrl)
{
ViewBag.ReturnUrl = returnUrl;
return View();
}
//
// POST: /Account/Login
[HttpPost]
public ActionResult Login(LoginModel model)
{
if (ModelState.IsValid)
{
if (model.IsUserExist(model.EMP_ID, model.EMP_PASSWORD))
{
FormsAuthentication.SetAuthCookie(model.EMP_ID, false);
}
else
{
ModelState.AddModelError("", "The User ID or Password provided is incorrect.");
}
}
return View(model);
}
设置好后authcookie,你都返回相同的登录视图。 –
你认为你在哪里告诉它去索引视图? – Chris