Solved

File Size limit in FIleUpload control in ASP.Net

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Why is "packages element is not declared"? 2 123
Auto refresh part of an MVC5 View 7 53
Name space syntax error 12 38
URL Redirect using IIS v8 4 18
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
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

947 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

23 Experts available now in Live!

Get 1:1 Help Now