Overriding ErrorPage.cshtml allows you to create custom error page for exceptons thrown from controllers, is there a way to handle exceptions thrown from filters? For example I would like to have custom page for anti forgery exceptions.
You can utilize exception filters. Just create your own FilterProvider
and have it implement IExceptionFilter
. Put all custom logic inside OnException(filterContext)
method.
Take a look at eg. current implementation of Orchard.Security.SecurityFilter
to have an idea.