Reputation:
I want to upload large files with FileUpload control. The page with this control located in Admin folder.
In admin folder's web.config file i set:
<httpRuntime maxRequestLength="900000"/>
But this does not effect!
Only if I set this line in root's web.config it works.
Why?
Upvotes: 2
Views: 228
Reputation: 5582
Consider using a location section (in the web.config that is located in the root):
http://msdn.microsoft.com/en-us/library/b6x6shw7(VS.71).aspx
Location - Path: The resource that the specified configuration settings apply to. Using location with a missing path attribute applies the configuration settings to the current directory and all child directories. If is used with no path attribute and allowOverride is specified to be false, configuration settings cannot be altered by Web.config files in child directories.
The following example sets the uploaded file size limit to 128KB for only the page specified.
<configuration>
<location path="UploadPage.aspx">
<httpRuntime maxRequestLength="128"/>
</location>
</configuration>
Upvotes: 3
Reputation: 53115
If you're using IIS7, there's an additional server change you need to make to allow large file uploads at the server level. I wrote a post with a lot of information about large file uploads in ASP.NET here.
Upvotes: 0
Reputation: 5362
the httpRuntime section is an application level setting, so it is not scoped to pages within a folder but to the entire application.
if you set the Admin area up as it's own application in IIS, this setting will work.
Upvotes: 2