【发布时间】:2011-06-03 07:10:10
【问题描述】:
当最大文件上传大小超过时,我试图将用户引导到错误页面。为此,我正在做以下事情:
public void Init(HttpApplication application)
{
application.BeginRequest += new EventHandler(application_BeginRequest);
}
void application_BeginRequest(object sender, EventArgs e)
{
HttpApplication application = (HttpApplication)sender;
HttpContext context = application.Context;
if (context.Request.ContentLength > 4096000)
{
context.Response.Redirect("~/Error.aspx");
}
}
public void Dispose()
{
}
但在上传大小超过最大文件大小的文件时,它会显示“连接重置”错误。 我该怎么做。
【问题讨论】:
标签: c# asp.net httpmodule