Open Sanjidhalim opened 2 years ago
Triage: Referencing this to https://github.com/dotnet/aspnetcore/issues/37857.
We're considering not registering the JQuery form validator by default in MVC applications. In the meantime, you can deregister it yourself by modifying the service collection when initializing MVC in your application.
Bad user input should return a Bad Request response instead.
The ApiController
has a set of built-in defaults for how it handles 4xx validation cases. Applying the FromForm
attribute to a parameter opts out of this behavior. To work around this, you can apply a filter to process this.
Marking as investigate to evaluate the intersection of model binding validation and 4xx response processing here.
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process.
Thanks for contacting us.
We're moving this issue to the .NET 7 Planning
milestone for future evaluation / consideration. Because it's not immediately obvious that this is a bug in our framework, we would like to keep this around to collect more feedback, which can later help us determine the impact of it. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
Triage: cc: @brunolins16 for his interest in the area
@Sanjidhalim While we still working on the consideration described here #37857. you could remove the JQueryFormValueProviderFactory
in your application if the JQuery support is not needed.
builder.Services.Configure<MvcOptions>(options => {
options.ValueProviderFactories.RemoveType<JQueryFormValueProviderFactory>();
});
That will produce the expected result:
{
"type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
"title": "One or more validation errors occurred.",
"status": 400,
"traceId": "00-577f8b3ea47d08e2cd4f44f33043be22-9be5d970557866de-00",
"errors": {
"spc": [
"The spc field is required."
]
}
}
Thanks for contacting us.
We're moving this issue to the .NET 8 Planning
milestone for future evaluation / consideration. Because it's not immediately obvious that this is a bug in our framework, we would like to keep this around to collect more feedback, which can later help us determine the impact of it. We will re-evaluate this issue, during our next planning meeting(s).
If we later determine, that the issue has no community involvement, or it's very rare and low-impact issue, we will close it - so that the team can focus on more important and high impact issues.
To learn more about what to expect next and how this issue will be handled you can read more about our triage process here.
When sending a request with content type
application/x-www-form-urlencoded
and a malformed key in the request body (e.g.[spc=123
) ASP NET Core throws an Internal Server Error with the following stack trace:Bad user input should return a Bad Request response instead.
Repro steps
WeatherForecastController
to Get method to:[spc=123