Last post Mar 24, 2007 07:54 AM by dileepkrishnan
Mar 22, 2007 08:20 AM|dileepkrishnan|LINK
I have trouble with the usage of FileUpload control provided for ASP.NET in Visual Studio 2005. When I use this control, it fails most of the times. Here are the steps to reproduce this problem.
1. Add a FileUpload control to the asp.net page your are working on.
2. Add a button and a label control to the same page.
3. Write the following code in the button's click event.
Label1.Text = "File Name : " + FileUpload1.FileName + "<br />" + "File Size : " + FileUpload1.FileBytes.Length;
4. Now run the application. It works well sometimes and fails some other times. This is how it fails - I click the button after browsing and loading a file in to the control and the browser shows "This page cannot be displayed" error message.
Can anybody help me with this?
Mar 22, 2007 10:55 AM|spvlong|LINK
Maybe the reason of this problem is the file size is more than the maxRequestLength value. maxRequestLength default value is 4096 which is 4MB.
You can change maxRequestLength in web.config as following (this will change the maxRequestLength to its maximum value - 2GB)
Hope this helps
Mar 24, 2007 07:54 AM|dileepkrishnan|LINK