You can set the filterContext so that it navigates to another action/view i.e.
private static void SetRedirectToLoginPageForContext(AuthorizationContext filterContext)
{
filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary
{
{ "controller", "Login" },
{ "action", "Index" }
});
}
public class UserAuthenticatedAction : FilterAttribute, IAuthorizationFilter
{
public void OnAuthorization(AuthorizationContext filterContext)
{
SetRedirectToLoginPageForContext(filterContext);
return;
}
}
In the above example, I'm setting the filter context so that, upon retuning, the user will be navigated to the Login/Index view.
Have a play around with this code, it should be similar for ActionFilters/GlobalFilters.