protected void Application_BeginRequest(object sender, EventArgs e)
{
const int maxFileSizeKBytes = 10240; //10 MB
const int maxRequestSizeKBytes = 305200; //~298 MB
if (Request.ContentLength > (maxRequestSizeKBytes * 1024))
{
Response.Redirect(".aspx?requestSize=" + Request.ContentLength.ToString());
}
for (int i = 0; i < Request.Files.Count; i++)
{
if (Request.Files[i].ContentLength > (maxFileSizeKBytes * 1024))
{
Response.Redirect(".aspx?fileSize=" + Request.Files[i].ContentLength.ToString());
}
}
}
이 코드는 Global.asax.cs 페이지에 있습니다. 이 확인을 실행 한 페이지로 리디렉션해야합니다. 그리고 ticketId 또는 projectId 매개 변수를 알아야합니다. 예를 들어 프로젝트보기 페이지에서 새 티켓을 만듭니다. /Project/ViewProject.aspx?projectId=1
오류 메시지를 표시하는 다른 페이지로 리디렉션하는 것이 좋지 않기 때문에 사용자에게 의미있는 메시지가있는이 페이지로 리디렉션해야합니다.응용 프로그램 수준 오류 처리기 리디렉션