日期:2014-05-18  浏览次数:20862 次

一段上传代码出了问题,高过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>