简体   繁体   中英

How do I use MVC HandleError attribute with JQueryUI Dialog?

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM