Problem uploading large files in ASP.NET

12. October 2012 10:35 by Mrojas in General  //  Tags: , , , ,   //   Comments (0)

If you try to upload large files you might get an exception like

HttpException: Maximum request lenght exceeded.

This problem occurs because the default value for the maxRequestLength parameter in the section 

of the machine.config or Web.config file is 4096 (4M).

So any file with a size bigger will fail.

However I think that the max size that you can write here is 2G 2097151

Some info can be found here:;EN-US;295626


So to change that for 512mb use something like:




        <httpRuntime maxRequestLength="524288" /> 



Silverlight and what to do with Application or User Settings or INI files

Some people ofter forget about this (even me Confused smile ) So that;’s why I’m posting about this.

In my work (at Artinsoft) we are currently performing a lot of Winforms and VB6 
migration to Silverlight. And a common problem is “What can I do with the user settings!!!”.

In VB6 you had your INI files and in Winforms you probably used something like the App settings.
But when you move to Silverlight what can you do!.
You need a set of initial values and you probably wont want to “burn” those inicial values in your XAP file.
It would be nicer if those values can just be set in the Web.Config file.

So a common way to solve this, is develop a simple helper class. This helper class will use a service that will
collect your initial ini files or appsettings values and store them in your Isolated Storage.
You can even use some kind of basic cryptography if you feel that your date is sensitive.

And then you can use the helpful IsolatedStorageSettings class. For example see this code,
that I borrowed from this post:

const string FAVCOLORNAME = "favoriteColor";
public Color? FavoriteColor
    if (IsolatedStorageSettings.ApplicationSettings[FAVCOLORNAME] != null)
      Color? colorSetting =         IsolatedStorageSettings.ApplicationSettings[FAVCOLORNAME] as Color?;
      if (colorSetting != null) return colorSetting;

    // If we can't find a favorite color, return a null color
    return new Color?();
    IsolatedStorageSettings.ApplicationSettings[FAVCOLORNAME] = value;

As you can see is very easy to save and recover simple settings from the Silverlight Isolated Storage