读书人

一段上传代码出了有关问题高过10MB文

发布时间: 2012-01-08 22:48:50 作者: rapoo

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

读书人网 >C#

热点推荐