My question is closely related to this question .
Here's a quick overview: My application runs in classic mode. I have the following code in Global.asax
protected void Application_Error(Object sender, EventArgs e)
{
HttpContext.Current.Server.Transfer("~/MyErrorPage.aspx", true);
}
Everything works fine (i.e., I see MyErrorPage.aspx) when an error occurs if
<httpErrors errorMode="Detailed" />
but when errorMode="Custom"(or the errorMode="DetailedLocalOnly"request was sent from the remote machine), I see the IIS user error page with my error page (MyErrorPage.aspx).
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
</html>
If I delete the default 500 error page from the IIS error page section, I get the following output (note that I get "Page cannot display ..." instead of a custom 500-page page)
The page cannot be displayed because an internal server error has occurred.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
</html>
, , IIS 500 , Server.Transfer.
MyErrorPage.aspx( ).
( ) (HttpContext.Current.Response.Clear()) Server.Transfer, .
Server.ClearError() , .
, , "fix" errormode="Detailed", , ASP.Net - , IIS 404 , url myApp/DoesNotExist.html. [ , , .]
"" - , , , : , URL- , , , , . , F5, . .
- , ? - ?
.
Edit
, :
http://rapidshare.com/files/427244682/Err.zip
[, .]
, , setstatus, .
BANG