How do I use MVC HandleError attribute with JQueryUI Dialog?
I have HandleErro开发者_如何学编程r 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?
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.
精彩评论