The code below is in my global.asax. When a user uploads a file that is to
big it catches the error and tells the user the problem. For some reason the
redirect never happens. When steping through the code it does step into the
redirect but continues to the next line like nothing happened and it does NOT
redirect! Any ideas why this would happen?
The code... (thanks Mike Gunderloy)...
protected void Application_Error(Object sender, EventArgs e){
if(Path.GetFileName(Request.Path) == "PictureManager.aspx"){
System.Exception appException = Server.GetLastError();
HttpException checkException = (HttpException)appException;
if(checkException.GetHttpCode() == 400 && checkException.ErrorCode ==
-2147467259){
// Error 400 = bad request, user
// tried to upload a file that's too large
Server.ClearError();
Response.Redirect("PictureManager.aspx?ImageTooLar ge=true");
}else{
Server.Transfer("ErrorPage.aspx", true);
}
}else{
Server.Transfer("ErrorPage.aspx", true);
}
}
Thanks for your thoughts