Boosting ASP.NET's Maximum File Upload Size
ASP.NET applications have a default maximum file upload size of 4MB. This limitation can be problematic when handling larger files. This guide demonstrates how to increase this limit.
Modifying web.config
The solution involves adjusting the web.config
file within your ASP.NET project. Locate the <system.web>
section and, within it, the <httpRuntime>
tag. The maxRequestLength
attribute within <httpRuntime>
defines the maximum HTTP request size in kilobytes (KB).
To raise the upload limit, modify the maxRequestLength
value. Replace "xxx" with your desired limit in KB. For instance:
<code class="language-xml"><configuration> <system.web> <httpRuntime maxRequestLength="10240" /> </system.web> </configuration></code>
This example sets the maximum upload size to 10MB (10240 KB). It's crucial to understand that this setting applies to the entire application and isn't configurable on a per-page level.
The above is the detailed content of How to Increase the Max Upload File Size in ASP.NET?. For more information, please follow other related articles on the PHP Chinese website!