HandleErrorAttribute and Remote Connections
July 23, 2008 – 09:15
Last week I upgraded my main application to MVC Preview 4. This morning I noticed that a number of users were receiving HTTP 500 error messages instead of being presented with a friendly error page.
It turns out the HandleErrorAttribute in Preview 4 is the culprit. Previously I’d been using MvcContrib’s RescueAttribute.
It appears that the HandleError attribute only works locally – when using a remote connection the server just displays the standard HTTP 500 message (this is under IIS7 using Integrated Pipeline).
I fired up the MVC source code and removed this line from HandleErrorAttribute.cs (line 85):
filterContext.HttpContext.Response.StatusCode = 500;
After doing this, the error pages are displayed correctly.
One Response
Hi there,
Thanks so much for the post. I have the same problem and it is killing me. I did what you suggested. However, after I updated the dll, it shows that the referencing failed. Is there anything I also needed to update in the webconfig?
Could you please help?
Many thanks,
Rui