Redirect after Session Timeout in MVC Action Filter
问题 I have to redirect to home page after session timeout in mvc 5 application. I am using following code : public class SessionExpireAttribute : ActionFilterAttribute { public override void OnActionExecuting(ActionExecutingContext filterContext) { var currentEnvironment = EnvironmentUtility.GetSession().Get<Environment>(); if (currentEnvironment == null) { filterContext.Result = new RedirectResult("~/Home/Index"); } base.OnActionExecuting(filterContext); } } In the controller, I have below code