question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Validation with MVC

See original GitHub issue

I am trying to implement custom validation via the ICustomValidation interface on my DTO but when the controller action is invoked we get this exception:

[AbpValidationException: Method arguments are not valid! See ValidationErrors for details.]
   Abp.Runtime.Validation.Interception.MethodInvocationValidator.Validate() in 

I realize now this is expected behavior. However, what I want is to be able to display custom validation errors my view. I am using traditional ASP.NET MVC 5 view, not Angular/API setup.

What is the pattern to do this?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
lommezcommented, Dec 14, 2018

@rahulbpatel, your action method return what kind of object, IActionResult? If so, try to change to ObjectResult

0reactions
stale[bot]commented, Nov 22, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom Validation Attribute In ASP.NET MVC
In this article, we will discuss custom validation with example in ASP.NET MVC. ... Open Visual Studio 2015 or a version of your...
Read more >
Model validation in ASP.NET Core MVC and Razor Pages
For scenarios that the built-in validation attributes don't handle, you can create custom validation attributes. Create a class that inherits ...
Read more >
ASP.NET MVC: Custom Validation by DataAnnotation
We can validate a model in an action method. The built-in validation attributes are Compare, Range, RegularExpression, Required, StringLength.
Read more >
Custom Validation using Data Annotations Attribute in Asp. ...
If you want your own Custom Validation, we need to inherit from ValidationAttribute and create it. Create Asp.Net MVC Application. First, create a...
Read more >
Custom Validation Attribute in MVC
Another example of creating a custom validation attribute in ASP.NET MVC. · Right-click on the “Common” folder and add a class file with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found