Solved

File Size limit in FIleUpload control in ASP.Net

Posted on 2007-04-04
4
714 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now