Why is a request that exceeds the specified maxRequestLength responds with a (apparently) irrelevant error?

I pointed maxRequestLengthin my web.config (MVC) like this:

  <location path="File/Upload">
    <system.web>
      <httpRuntime maxRequestLength="330"/>
    </system.web>
  </location>

When you look at the network tab when testing to download files exceeding 330 kilobytes, I see that the answer is from the server 500, and the details areThe required anti-forgery form field &quot;__RequestVerificationToken&quot; is not present.

Why is this so? Is the structure unable to provide details maxRequestLengthin the response? Or does he just not want to not give out information about the system?

Or is it that my request was truncated / trimmed in order to satisfy the limit that accidentally ended the request validation token?

Note

This works fine with files that do not exceed 330kb, and my download works.

+4
3
0

, ( , ) [ValidateAntiForgeryToken] - , .

[ValidateAntiForgeryToken] , , , , .

0

, , ASP.NET MVC location web.config. , ASP.NET, , ASP.NET MVC . , , , , .

- auth?

, , "".

, 500 Internal Server Error, , - , web.config - .

As for the antiforgery marker error, make sure it is present in your view (using @ Html.AntiForgeryToken () ) and that no script removes it from the DOM before you submit the form

0
source

Source: https://habr.com/ru/post/1628511/


All Articles