Response.Redirect not working inside an custom ActionFilter

Posted by mitch on Stack Overflow See other posts from Stack Overflow or by mitch
Published on 2010-05-04T12:17:15Z Indexed on 2010/05/04 15:18 UTC
Read the original article Hit count: 327

My code is the following

public class SessionCheckAttribute : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        if (/*condition*/)
        {
            filterContext.HttpContext.Response.Redirect("http://www.someurl.com",true);

        }
         base.OnActionExecuting(filterContext);
    }

}

Now, the question is WHY does the action that is has [SessionCheck] applied to it STILL executes. Any ideas? Thanks.

© Stack Overflow or respective owner

Related posts about redirect

Related posts about custom