views:

14

answers:

1

Hi,

I have a small ASP.Net MVC 2 project that contains two areas as well as some shared views. In my root HomeController, I have added the HandleError attribute and when I throw an exception in one of the actions, I get redirected to the Error.aspx page.

I have another controller, TitlesController, that resides under an Area and when that generates an exception I'm taken to the standard yellow ASP.Net error page. I have decorated TitlesControlelr n the same way as the HomeController.

Can anyone tell me if HandleError is supported on controllers that reside in an Area?

I should note that when HomeController directs me to the Error.aspx, I don't see any stack trace. I'm led to believe that when when viewing these pages locally, MVC 2 should display a stack trace.

A: 

I have exactly the same problem. I have my custom error view displaying nicely if an error is thrown from a top level controller but the standard ASP.NET yellow error page if the error is thrown from a controller inside an Area. I even copied my Error.aspx view to the shared view folder in the Area and that did not fix the problem either.

...here is an update on the problem. I now have my area controller error handling working if I use the VS2010 built-in web server, but not if I use IIS7. So I believe it is some setting somewhere in IIS7 perhaps?

...I now have it all working but sadly I cannot give you anything better than IIS cacheing. I restarted IIS7 and now it works? This does not make sense as it worked in IIS7 if the error came through a top level controller but not an area controller and this area is not a new thing only the HandleError attribute was new... Duh?

Steve Phillips