public class ErrorModule : ApplicationErrorModule
{
protected override void OnDisplayError(
WebErrorHandler errorHandler,
ErrorViewModel model)
{
var response = HttpContext.Current.Response;
// Create an arbitrary controller instance
var controller =
ViewRenderer.CreateController<GenericController>();
string html = ViewRenderer.RenderPartialView(
"~/views/shared/Error.cshtml",
model,
controller.ControllerContext);
HttpContext.Current.Server.ClearError();
response.TrySkipIisCustomErrors = true;
response.ClearContent();
response.StatusCode = 500;
response.Write(html);
}
}
// *any* controller class will do for the template
public class GenericController : Controller
{ }