我有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