In a previous post, I have already shared how to upload a file to the server, but the default behavior is not always as expected. This post shows to increase upload file size in ASP.NET 2.0.

In ASP.NET, ISS sets a maximum upload file by default. We can’t upload files with size more than 4Mb, because it’s already configured in the machine.web file. as follows:

<httpRuntime maxRequestLength =”4096″/>  where 4096 in kb

Although you can overload these settings in the web.config file

add in the <system.web>

<httpRuntime maxRequestLength =”5120″/> 

Which allows uploading files up to for example 5120 = 5Mb.