Redirect with RedirectToRouteResult does not work from other area

Viewed 30405

I have this ActionFilter

public class AppOfflineFilter : ActionFilterAttribute
{
    public override void OnActionExecuting(ActionExecutingContext filterContext)
    {
        if (filterContext.ActionDescriptor.ActionName != "AppOffLine" &&
            filterContext.HttpContext.Request.UserHostName != "127.0.0.1")
        {
            filterContext.Result = new RedirectToRouteResult(
                 new RouteValueDictionary(
                     new  { action = "AppOffLine", Controller = "Home" }));
        }
    }
}

It works from the start page which is does not reside under a Area, it does not work from an area because it will redirect to /Area/Home/Appoffline instead of /Home/AppOffline

Can it be fixed?

Also is there a way of speciefing which controller / action to redirect to using Generics and strongly typed code?

2 Answers
Related