Monday, January 5, 2009

Catch the exception caused by massive file size upload in asp.net 2.0

Put the code in Global.asax under c:\Inetpub\wwwroot\wss\VirtualDirectories\80

void Application_Error(object sender, EventArgs e)

{

//To catch the error caused by masssive file size upload more than 4MB.

HttpException httpEx = Server.GetLastError() as HttpException;

if(httpEx.ErrorCode == -2147467259)

{

HttpContext.Current.Server.ClearError ();

HttpContext.Current.Server.Transfer("ErrorMessage.aspx");

}

}

No comments: