<p>I have a form that excepts a file upload in ASP.NET. I need to increase the max upload size to above the 4 MB default.</p>

<p>I have found in certain places referencing the below code at <a href="http://msdn.microsoft.com/en-us/library/system.web.configuration.httpruntimesection.maxrequestlength.aspx" rel="noreferrer">msdn</a>. </p>

<pre><code>[ConfigurationPropertyAttribute("maxRequestLength", DefaultValue = )]
</code></pre>

<p>None of the references actually describe how to use it, and I have tried several things with no success. I only want to modify this attribute for certain pages that are asking for file upload.</p>

<p>Is this the correct route to take? And how do I use this?</p>

If its windows 2003 / IIS 6.0 then check out AspMaxRequestEntityAllowed = "204800" in the file
metabase.xml
located in folder C:\windows\system32\inetsrv\
The default value of "204800" (~205Kb) is in my opinion too low for most users. Just change the value to what you think should be max.
If you cant save the file after editing it you have to either stop the ISS-server or enable the server to allow editing of the file:
(source:
itmaskinen.se
)
Edit: I did not read the question correct (how to set the maxrequest in webconfig). But this informatin may be of interrest for other people, many people who move their sites from win2000-server to win2003 and had a working upload-function and suddenly got the
Request.BinaryRead Failed
error will have use of it. So I leave the answer here.