public ActionResult Logout(string lang) { _accountService.Logout(); TempData["Message"] = "Logout.Submit.Success"; return(Redirect(AccountRedirectUrls.Home(lang))); }
public override void OnActionExecuting(ActionExecutingContext filterContext) { if (filterContext.IsChildAction) { return; } var action = filterContext.ActionDescriptor; var context = filterContext.HttpContext; var language = GetLanguage(context.Request); var loginUrl = AccountRedirectUrls.LoginPage(language); var homeUrl = AccountRedirectUrls.Home(language); if (HasAttribute <AuthorizedOnlyAttribute>(action) && !IsAuthenticated(context)) { filterContext.Result = new RedirectResult(loginUrl); } if (HasAttribute <GuestsOnlyAttribute>(action) && IsAuthenticated(context)) { filterContext.Result = new RedirectResult(homeUrl); } }