Posting large files

I want to upload large files using the FileUpload control. The page with this control is located in the admin folder.

In the admin folder the web.config file I have set:

   <httpRuntime maxRequestLength="900000"/>

      

But it doesn't matter!

Only if I set this line in the root web.config it works.

Why?

+2


source to share


3 answers


Consider using the location section (in the web.config file that is at the root):

http://msdn.microsoft.com/en-us/library/b6x6shw7(VS.71).aspx

Location - Path: The resource to which the specified configuration settings belong. Using a location with a missing path attribute applies the configuration settings to the current directory and all child directories. If used without a path attribute and allowOverride is false, configuration settings cannot be changed by Web.config files in child directories.



The following example sets the uploaded file size limit to 128 KB for the specified page only.

<configuration>
   <location path="UploadPage.aspx">
      <httpRuntime maxRequestLength="128"/>
   </location>
</configuration>

      

+3


source


the httpRuntime section is application-level, so it is not tied to pages in a folder, but to the entire application.



if you set admin realm as a native app in IIS, this setting will work.

+2


source


If you are using IIS7, add an additional server change that must be made 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 .

0


source







All Articles