如何使ASP文件上传控制接受大文件? [英] How to make the ASP File Upload control accept large files?

查看:181
本文介绍了如何使ASP文件上传控制接受大文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要上传使用ASP 文件上传控制文件。不过,如果我尝试和增加限价约10000 KB,它不工作,并接受文件只高达4 MB的大小,我得到一个错误,指出与服务器的连接被重置。我提到: HTTP://www.$c$cproject.com/KB/书籍/ ASPNET20FileUpload.aspx http://msdn.microsoft.com /en-us/library/aa478971.aspx ,但是当我修改了web.config.comments文件,什么都没有发生。我在哪里去了?

另外,我想知道当我在Web服务器上部署它这会工作。我在code问,因为后面,我还在给了该文件是要上载的路径硬codeD值。这是如何工作的?


解决方案

 <&的System.Web GT;
  <的httpRuntime的maxRequestLength =102400executionTimeout =360/>
< /system.web>

这是你在找什么。更改Web.config文件中的 executionTimeout 属性。

根据本网站


  

的maxRequestLength - 属性限制
  文件上传大小ASP.NET
  应用。此限制可用于
  服务攻击prevent否认
  (DOS)所造成的用户在发布大
  文件到服务器。尺寸
  指定以KB为​​单位。如
  前面提到的,默认为
  4096(4 MB)。最大值为1048576
  (1 GB)用于.NET Framework 1.0 / 1.1和
  2097151(2 GB)用于.NET Framework
  2.0。


  
  

executionTimeout - 属性指示
  秒,一个最大数
  请求被允许之前执行
  由被自动关闭
  应用。该executionTimeout
  值应始终大于较长
  时间量的上传过程
  可以采取。


I would like to upload files using the ASP FileUpload control. However, if I try and increase the limit to about 10000 kB, it doesn't work and accepts files only upto 4 MB in size and I get an error saying that the connection to the server was reset. I referred: http://www.codeproject.com/KB/books/ASPNET20FileUpload.aspx and http://msdn.microsoft.com/en-us/library/aa478971.aspx, but when I modified the web.config.comments file, nothing happened. Where am I going wrong?

Also, I wanted to know how this would work when I deploy it on the web server. I'm asking because in the code behind, I'm still giving a hard coded value for the path where the file is to be uploaded. How does this work?

解决方案

<system.web>
  <httpRuntime  maxRequestLength="102400" executionTimeout="360"/>
</system.web>

This is what you are looking for. Change the executionTimeout property in web.config file.

According to this website,

maxRequestLength - Attribute limits the file upload size for ASP.NET application. This limit can be used to prevent denial of service attacks (DOS) caused by users posting large files to the server. The size specified is in kilobytes. As mentioned earlier, the default is "4096" (4 MB). Max value is "1048576" (1 GB) for .NET Framework 1.0/1.1 and "2097151" (2 GB) for .NET Framework 2.0.

executionTimeout - Attribute indicates the maximum number of seconds that a request is allowed to execute before being automatically shut down by the application. The executionTimeout value should always be longer than the amount of time that the upload process can take.

这篇关于如何使ASP文件上传控制接受大文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆