I am working on an MVC5 project that allows users to upload files. I already have methods to filter out invalid file extensions (only pictures and pdfs are allowed). However, when I try to upload a large file, regardless of extension, I get this error:
HTTP Error 404.13 - Not Found
The request filtering module is configured to deny a request that exceeds
the request content length.
The method to upload doesn't even get called, it just goes straight to the error page.
One post I found expressed that I needed to modify my project's web.config
file, and I did as such:
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="6000000" />
</requestFiltering>
</security>
I still get the error, so I also tried adding <httpRuntime maxRequestLength="6000" executionTimeout="3600" />
to <system.web>
, but that threw this error:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data
for the page is invalid.
Obviously this line must be for earlier versions of IIS.
I also found another solution that suggested editing the applicationHost.config
file on my server like the project's web.config
; this also did nothing.
Any suggestions?