I have an ActionFilter that checks if a parameter in the URL is valid. If it is not valid I have to render a View. I dont want to redirect, because I still need the ActionEx
Yes. Look at the source for HandleErrorAttribute.
Try this
[HandleError]
public ActionResult MyAction (int id)
{
// ...
}
And put the view you want rendered in to ~/Views/Shared/Error.ascx
.
HandleErrorAttribute
had what I was looking for.
filterContext.Result = new ViewResult
{
ViewName = "MessagePage",
ViewData = filterContext.Controller.ViewData,
TempData = filterContext.Controller.TempData
};