首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

一段上传代码出了有关问题,高过10MB文件就不调用button方法!(内附上传代码)

2012-01-08 
一段上传代码出了问题,高过10MB文件就不调用button方法!(内附上传代码)protected void Button2_Click(obje

一段上传代码出了问题,高过10MB文件就不调用button方法!(内附上传代码)
protected void Button2_Click(object sender, EventArgs e)
  {
  string fullName = this.File1.Value;
  if (fullName != "")
  {
  string fileName = fullName.Substring(fullName.LastIndexOf("\\") + 1);
  string name = fileName.ToString().Trim();
  if (id != 0 && id > 0)
  {
  if (flag2 == true)
  {
  this.File1.PostedFile.SaveAs(Server.MapPath("UploadAnnex\\") + name);
  Response.Redirect("~/OtherRelatedManagement/LawsPrint.aspx");
  }
  }
  }
  }
就是上面代码,我不知道为什么超过10mb的文件或。rar都不能调用这个button方法

[解决办法]
在Web.Config里加上<httpRuntime maxRequestLength="102400" executionTimeout="9000"/>
[解决办法]

探讨
XML code <system.web>
<httpRuntime maxRequestLength="102400" executionTimeout="900"/>
</system.web>

热点排行