2
votes

I've searched for a while, but can't seem to find anything that deals with the specific situation I'm facing.

I've set maxRequestLength to 5MB like so...

<httpRuntime maxRequestLength="5120"/>

and then I've set maxAllowedContentLength to 20MB...

<requestLimits maxAllowedContentLength="20971520"/>

For some reason though the lower limit is ignored. My application is allowing files up to 20MB to be uploaded.

It thought anything over maxRequestLength should trigger a .Net exception.

The application is classic ASP, with a custom Interop COM object managing the upload.

If I upload directly with .Net, the limits are respected, and the exceptions are thrown.

Does anyone know why maxRequestLength is ignored for ASP and/or COM?

This is happening in IIS 8 and IIS 10.

I have the following set, if it makes a difference...

<modules runAllManagedModulesForAllRequests="true"/>
1

1 Answers

2
votes

Does anyone know why maxRequestLength is ignored for ASP and/or COM?

As well as all the other system.web settings, it is an ASP.NET setting. You already have experienced. So it's normal to be ignored for non ASP.NET requests.

From httpRuntime Element (ASP.NET Settings Schema)

Configures ASP.NET HTTP run-time settings that determine how to process a request for an ASP.NET application.