Here is the context:
ASP MVC3 - IIS 7
I am using ElMah configured very well as documented nearly everywhere for MVC. And it is working.
Here is what I have in my config file
<system.web>
<httpRuntime maxRequestLength="1024" enableVersionHeader="false" />
<customErrors mode="On" defaultRedirect="~/Error/Generic" />
...
<system.webServer>
<httpErrors errorMode="Detailed" existingResponse="PassThrough" defaultPath="~/Error/Generic" defaultResponseMode="ExecuteURL"></httpErrors>
Now here is my problem I spent the whole day trying to catch this error : "Maximum request length exceeded" when I submit a file that exceed 1024 bytes
Between asp errors and IIS errors and sometimes IE interception, I'am getting crazy I cannot understand why this is so complicated. I already tried these solutions and none worked for me solution 1 Solution 2
Thank you for your help
Large file uploads in ASP.NET The default maximum filesize is 4MB - this is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. If a user uploads a file larger than 4MB, they'll get an error message: "Maximum request length exceeded."
The MaxRequestLength property specifies the limit for the buffering threshold of the input stream. For example, this limit can be used to prevent denial of service attacks that are caused by users who post large files to the server.
When setting maxRequestLength to 1024 this means 1024 kilobytes, not 1024 bytes. Maybe this is why the exception isn't thrown.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With