public IActionResult Login(LoginViewModel loginVM) { ViewBag.ErrorMessage = null; if (loginVM.Username.Equals(_AdminPass["admin"]) && loginVM.Password.Equals(_AdminPass["pass"])) { AppCookieHelper.Set(_AdminPass, "admin", loginVM.IsRemember, "AssigningTasksSample", this.HttpContext); return(RedirectPermanent(SiteHelper.GetBaseUrl(HttpContext.Request) + "/Assignee/Simulation")); } return(View()); }
protected void Application_Error(object sender, EventArgs e) { Exception exception = Server.GetLastError(); Response.Clear(); HttpException httpException = exception as HttpException; if (httpException != null) { string action; switch (httpException.GetHttpCode()) { case 404: // page not found action = "Index404"; break; case 500: // server error action = "Index500"; break; default: action = "home"; break; } // clear error on server Server.ClearError(); if ("home".Equals(action)) { Response.Redirect(SiteHelper.GetBaseUrl()); } else { Response.Redirect(String.Format("~/Error/{0}/?url={1}", action, HttpContext.Current.Request.Url.OriginalString)); } } }
public IActionResult Logout() { AppCookieHelper.LogOut(this.HttpContext); return(RedirectPermanent(SiteHelper.GetBaseUrl(HttpContext.Request) + "/Account/Login")); }