Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = true)]
- public class SessionExpireFilterAttribute : ActionFilterAttribute
- {
- public override void OnActionExecuting(ActionExecutingContext filterContext)
- {
- HttpContext ctx = HttpContext.Current;
- // If the browser session or authentication session has expired...
- if (ctx.Session["USER_ID"] == null )
- {
- filterContext.Result = new RedirectToRouteResult(
- new RouteValueDictionary {
- { "Controller", "Employer" },
- { "Action", "SessionTimeout" }
- });
- }
- base.OnActionExecuting(filterContext);
- }
- }
- [SessionExpireFilter]
- public class EmployerController : Controller
- {
- //Action Methods
- }
- This webpage has a redirect loop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement