Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

What’s the difference between maxRequestLength and maxAllowedContentLength

I don’t pay too much attention to what’s in the web.config so I always learn something when someone asks me how/why something works in the web.config.

When you see Maxrequestlength (in system.web) and Maxallowedcontentlength (in system.webServer) you ask why are 2 different attributes on length allowed.

They do serve different purposes.

maxRequestLength sets the max file upload size supported by ASP.NET.  The default size is 4096 KILOBYTES (4 MB).

maxAllowedContentLength sets the max length of content in a request supported by IIS. The default size is 30000000 BYTES (~28.6 MB).

NOTICE ONE IS IN KILOBYTES AND ONE IS IN BYTES!

Now why do you care about these settings.  If you are trying to upload large files (like images or documents) you need to be aware that you may need to adjust your maxRequestLength.  Then if files are really big you may need to adjust the maxAllowedContentLength.

What setting is the smallest takes precedence.




This post first appeared on Random Technical Thoughts | Things I Want To Remem, please read the originial post: here

Share the post

What’s the difference between maxRequestLength and maxAllowedContentLength

×

Subscribe to Random Technical Thoughts | Things I Want To Remem

Get updates delivered right to your inbox!

Thank you for your subscription

×