Sunday, May 15, 2011

Page cannot be displayed when you upload using Asp.Net application


You may receive ‘Page cannot be displayed’ error message when you upload a large file using Asp.Net application. This is because the default size supported by Asp.Net 2.0 is 4MB. When you try to upload a file size more than the default you will receive this error. 

To fix this we have two properties in httpRuntime, namely,

·         executionTimeout
·         maxRequestLength

By modifying it you can upload a file sized more than the default. Usually maxRequestLength is mentioned in KB. You can set the maximum value according to the need.
Below configuration is used to upload a 10MB file,

<system.web>
<httpRuntime executionTimeout="1000" maxRequestLength="10240"/>
</system.web>

Fine tune executionTimeout value in order with maxRequestLength.

No comments:

Post a Comment