FileUpLoad控件上传大容量文件

在Web.Config文件中设置

<system.web>
<httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>
在运行时取得WebConfig文件中的最大文件配置信息
WebConfigurationManager(命名控件:System.Web.Configuration)
System.Configuration.Configuration config = WebConfigurationManager.OpenWebConfiguration("~");
HttpRuntimeSection section = config.GetSection("system.web/httpRuntime") as HttpRuntimeSection;
double maxFileSize = Math.Round(section.MaxRequestLength / 1024.0, 1);
FileSizeLimit.Text = string.Format("Make sure your file is under {0:0.#} MB.", maxFileSize);
参考资料:http://www.infoq.com/cn/news/2008/01/handling-large-uploads
         http://aspnetresources.com/articles/dark_side_of_file_uploads.aspx
         http://www.aspnetresources.com/articles/CustomErrorPages.aspx
外文博客:http://weblogs.asp.net/jgalloway/
 
原文地址:https://www.cnblogs.com/zqstc/p/1636417.html