ASP.NET File Upload Progress - How to upload large files

If you want upload large files without problems, always set InnerFiles property of the File Upload Progress control to "true". See Server side properties.

Set large value of maxRequestLength in <httpRuntime> element in your Web.config .

Example:


<httpRuntime maxRequestLength="2097151" executionTimeout="1200" />

Also you should change some settings of your IIS.

Open your metabase.XML which is located in c:\Windows\System32\Inetsrv find the line "AspMaxRequestEntityAllowed" and change it to "1073741824". This is 1GB - of course you can enter another value to suite your needs.

This change does not require stopping IIS, but to make the Metabase.xml file write-able, you need to go to the IIS control panel, right click the server, select properties, and check off the box that says "allow changes to MetaBase configuration while IIS is running".

AspMaxRequestEntityAllowed property specifies the maximum number of bytes allowed in the entity body of an ASP request. If a Content-Length header is present and specifies an amount of data greater than the value of AspMaxRequestEntityAllowed, IIS returns a 403 error response.

This property is related in function to MaxRequestEntityAllowed, but is specific to ASP request. Whereas you might set the MaxRequestEntityAllowed property to 1 MB at the general World Wide Web Publishing Service (WWW Service) level, you may choose to set AspMaxRequestEntityAllowed to a lower value, if you know that your specific ASP applications handle a smaller amount of data.

Settings for IIS7
  • Add these lines in the web.config file (allowing uploads of files up to 100MB):
    <system.webserver>
        ...
        <security >
             <requestFiltering>
                   <
    requestLimits maxAllowedContentLength="1024000000" />
             </
    requestFiltering>
        </security>
    </
    system.webserver>

  • Open the file C:\Windows\System32\inetsrv\config\applicationHost.config and find the line:
    <section name="requestFiltering" overrideModeDefault="Deny" />

  • Set the overrideModeDefault property to Allow. So now the line should look like:
    <section name="requestFiltering" overrideModeDefault="Allow" />