Base solution for your next web application
Open Closed

[SOLVED] Handling MVC Action Filter Validation #1453


User avatar
0
psyvision created

Hi,

I was previously using Abp 0.9.7 in an MPA scenario using MVC's model validation (ModelState.IsValid etc) which was working okay with displaying errors to the end user. We are using full page post-backs rather than AJAX.

I have upgraded the application to 0.10 and notice that the validation mechanism has changed. Unless I add [DisableValidation] to a controller action then the AbpValidationFilter will throw an exception when called with an invalid model and my end user sees the standard ASP.NET yellow screen rather than the form with the validation errors shown.

This seems related to this change: <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1176">https://github.com/aspnetboilerplate/as ... ssues/1176</a>

Is there a suitable way to handle this other than showing a generic error screen? I don't want to disable the automatic validation at the service (.Application) level.

Thanks


1 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    see <a class="postlink" href="https://github.com/aspnetboilerplate/aspnetboilerplate/issues/1239#issuecomment-235510964">https://github.com/aspnetboilerplate/as ... -235510964</a>