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.
I have found in certain places referencing the below code at msdn.
[ConfigurationPropertyAttribute("maxRequestLength", DefaultValue = )]
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.
Is this the correct route to take? And how do I use this?
I have a blog post on how to increase the file size for asp upload control.
From the post:
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:
alt text http://blogs.itmaskinen.se/image.axd?picture=WindowsLiveWriter/Request.BinaryReadFailedwindows2003IIS.0_BC5A/image_2.png
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.
I believe this line in the web.config will set the max upload size:
If you use sharepoint you should configure max size with Administrative Tools too: kb925083
To increase uploading file's size limit we have two ways
1. IIS6 or lower
Example: if you want to restrict uploads to 15MB, set maxRequestLength to “15360” (15 x 1024).
2. IIS7 or higher
Example : if you want to restrict uploads to 15MB, set maxRequestLength to “15360” and maxAllowedContentLength to "15728640" (15 x 1024 x 1024).
MSDN Reference link : https://msdn.microsoft.com/en-us/library/e1f13641(VS.80).aspx
for a 2Gb max limit, on your application web.config :