Solved

File Size limit in FIleUpload control in ASP.Net

Posted on 2007-04-04
4
720 Views
Last Modified: 2009-08-01
Hey,

I'm testing out my webapp on a localhost and I'm using the FileUpload Control. I'm able to upload small files but when I try to upload files that are few megabytes I get the following page in IE7
Internet Explorer cannot display the webpage
   
   Most likely causes:
You are not connected to the Internet.
The website is encountering problems.
There might be a typing error in the address.


or

The connection was reset

     

     
     
     

     
       
       

         

The connection to the server was reset while the page was loading.

       


       
       


    *   The site could be temporarily unavailable or too busy. Try again in a few
          moments.

    *   If you are unable to load any pages, check your computer's network
          connection.

    *   If your computer or network is protected by a firewall or proxy, make sure
          that Firefox is permitted to access the Web.

In Firefox, it worked fine when I uploaded a file that was 1.86mb's but failed when I tried to upload a file larger than 4mb (I didn't test between 2-4). Is there an option I'm missing in IIS or ASP.Net?
0
Comment
Question by:rebels_mascot
  • 2
  • 2
4 Comments
 
LVL 4

Accepted Solution

by:
jasco4617 earned 500 total points
ID: 18851392
In your web.config file you can add the follow information:

<system.web>

      <httpRuntime maxRequestLength="11000" executionTimeout="120"  />

</system.web>


This will allow for something the input stream buffer size to be 11000 KB or about 10.75 MB and allow the request to take 120 seconds to complete which woudl give enough time for that about of data to be uploaded (hopefully).  you can tweak these settings to your need though.

Also, the default size for the input stream is 4MB which is why your uploads of larger thatn 4MB are not working.

- pat
0
 

Author Comment

by:rebels_mascot
ID: 18851423
Thanks for the quick reply Pat,

I just came across a post saying "To solve this problem go to C:\windows\system32\inetsvr and edit metabase.xml after stopping IIS." but when I went to that folder there was only a metabase.bin file.

Does <httpRuntime maxRequestLength="11000" executionTimeout="120"  /> overwrite the value set in the metabase file?
0
 

Author Comment

by:rebels_mascot
ID: 18851443
Thanks Pat that did the job.
0
 
LVL 4

Expert Comment

by:jasco4617
ID: 18851524
Not a problem.

As to your question about the metabase.xml file:  That file holds the configuration for IIS not ASP.NET and I am pretty unfamilar with it so i can not speak to which values needed edited in it to adjust the request length.  The web.config entry i gave you overrides the global IIS settings which are stored in the "C:\windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config" file.  I would suggest not editting it unless you tighten the security in it as it applies to all asp.net application running on that machines.  For instances like this where you are opening the security alittle you should do it on a per application (or even directory) basis.

Have fun!
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Message not shown 5 49
.NET tools for adding thread safety to a web app? 3 31
Application gets hammered - IIS 2 36
Publishing SSRS Reports to an IIS Server 3 40
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Lync server 2013 or Skype for business Backup Service Error ID 4049 – After File Share Migration
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

786 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question