Is the HandleError attribute used for Controllers and/or Actions applicable for EPiServer MVC applications? Can't figure out how to use it...
You need to register it to activate it, either globally or on your controller, like with any ASP.NET MVC application. More information: http://msdn.microsoft.com/en-us/library/system.web.mvc.handleerrorattribute(v=vs.118).aspx
I have activated it and I have been able to show an error page. But is there a possibility to choose an action or controller or an url to a page like this:
[HandleError(ExceptionType = typeof(HttpAntiForgeryException), View = ServiceLocator.Current.GetInstance<UrlResolver>().GetVirtualPath(page.ContentLink))]
public ActionResult Index(EmployeePage currentPage, EmployeeModel.EmployeeFormDataModel employeeFormData)
This of course doesn't work but is it possible to do something like this?
Or do the error page has to be a static page?
I would just create a custom HandleError attribute (that inherits from HandleErrorAttribute) and override the OnException method (and add your redirect logic there).
Thanks! I will try it out!