views:

16

answers:

1

I have HandleError attribute working normally, however:

I have a jqueryui dialog that displays a partial view. If i generate an error in this action the dialog just remains blank and no redirect to the Error.aspx page.

What do I need to do to get this to work?

A: 

In case an exception inside a controller action the HandleError attribute catches this exception and renders the Error view. Problem is it sets the StatusCode to 500. When jQuery sees this status code it considers the request failed and doesn't even bother to show the contents. On way to workaround this is to write a custom error handler attribute deriving from the standard one and overriding the OnException method by setting the status code to 200 when rendering the Error view.

Darin Dimitrov
looks like you answered previously on a better worded question. http://stackoverflow.com/questions/3274808/how-can-i-make-handleerrorattribute-work-with-ajax
Jonathan Kaufman
@Jonathan, yes it seems like that. I don't remember what I ate for breakfast this morning so don't expect me remembering things I answered on 18th of July :-)
Darin Dimitrov