The Temple of Fu

code, systems and games

Internet Explorer cannot display the webpage because of fileupload size

with one comment

So I was adding an input for the file upload control. Upon upload I would check the file size against a known size limit within my application. While testing trying to exceed the maximum upload size limit I was receiving from Internet Explorer a “..cannot display the web page error.” So I tried doing a try catch within the page to see if I could catch an error but the error couldn’t be caught there. Once I figured out that the error was never going to be caught there due to the nature of the request/response cycle I thought about trying to catch the error within Global.asax but that seemed hokey considering all I wanted to do was to display a message to the user that they had exceeded the limit. Well the answer lay in the web.config. What I needed to do was tell the web server (I was using Visual Studio built in) that it’s OK to allow file uploads of ‘X’ size. Where X is larger than the maximum size you want your application to allow for file uploads, in my case 5MB. So I added the following into the
system.web element of the web.config.
httpRuntime executionTimeout="600" maxRequestLength="6000"

I then throw an InvalidOperationException when checking for file upload size and catch that within my interface and display a nice friendly “sorry too large” message.

Hope that helps!


Written by lordfu

September 24, 2010 at 10:31 am

Posted in ASP.Net, Development

One Response

Subscribe to comments with RSS.

  1. Certainly helped me – thanks a lot.


    November 1, 2011 at 11:21 am

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: