Skip to content

POSTing large form data silently results in null-parameters #36214

@alex-jitbit

Description

@alex-jitbit

Describe the bug

I have a very simple ASP.NET 5 (Core) MVC app with this action method:

[HttpPost]
public IActionResult Send(string message, string secret)
{
    // ...
}

This method is called by external API that is POST'ing very(!) large data in the "message" form field. Like, 35-megabytes big.

This results in all parameters being "null". Silently. No exception is thrown. No log entry. Just have the "null" and good luck investigating ¯\_(ツ)_/¯

Smaller data works fine

THE FIX

This is obviously because of the size. Adding this attribute fixes the issue:

[RequestFormLimits(ValueLengthLimit = 50000000, MultipartBodyLengthLimit = 50000000)] //the fix
[HttpPost]
public IActionResult Send(string message, string secret)
{
    // ...
}

I'm not the only one with this problem: https://stackoverflow.com/questions/61295714/asp-net-core-3-1-argument-model-always-null-with-large-form-data-in-controller

Proposal

It would be nice if some kind of exception was thrown, so we know something's wrong. Like the "classic" ASP.NET always did - with the "request length" exception.

Further technical details

  • ASP.NET Core version 5.0.5

Metadata

Metadata

Assignees

Labels

✔️ Resolution: By DesignResolved because the behavior in this issue is the intended design.Needs: Author FeedbackThe author of this issue needs to respond in order for us to continue investigating this issue.Status: Resolvedfeature-model-bindingold-area-web-frameworks-do-not-use*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions