您的位置:首页 > 其它

FormsAuthentication.SignOut(); FormsAuthentication.SetAuthCookie(u.UserName, false);

2016-09-07 15:38 393 查看
        //Authentication/Login

         // GET: Authentication

         public ActionResult Login()

         {

             return View();

         }

         public ActionResult Logout()

         {

             FormsAuthentication.SignOut();

             return RedirectToAction("Login");

         }

          [HttpPost]

         public ActionResult DoLogin(UserDetails u)//Authentication/DoLogin

          {

              EmployeeBusinessLayer bal = new EmployeeBusinessLayer();

              if (bal.IsValidUser(u))

              {

                  FormsAuthentication.SetAuthCookie(u.UserName, false);

                  return RedirectToAction("Index", "HOME");

              }

              else

              {

                  ModelState.AddModelError("CredentialError", "Invalid Username or Password");

                  return View("Login");

              }

          }
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐