Search This Blog

Thursday, October 9, 2008

Dealing with the maximum upload size of ASP.NET

A lot of sites allow people to upload a file like pictures, word documents, ... or even videos. ASP.NET provides an easy way to do this(1).
What not everyone seems to know that ASP.NET only allows, by default to upload 4Mb of formdata to the server. Endusers can get frustrated when they try to upload their large sized document or video and see, after wasting bandwidth and time, that they don't succeed. This leaves your endusers with a bad taste in their mouth about your application and most likely they won't return or go to the competition.
However, as with many things in ASP.NET, this can be easily adjusted. Open up the web.config file of your current application and check the line, or add it in case it isn't already in the config file, (2). This has an attribute maxRequestLength that you can set. The number represents the amount of kilobytes that the total form can transfer to the server. Setting this to a higher number than the default 4098 allows you, the developer, to let endusers upload larger sized files.

Chinchu Narayan

No comments: