Application_Error не запускается?

In Webform1.aspx.cs:

protected void Page_Load(object sender, EventArgs e)
{
    throw new Exception("test exception");
}

In the Global.asax.cs:

protected void Application_Error(object sender, EventArgs e)
{
    // Code that runs when an unhandled error occurs
    if (Server.GetLastError() is HttpUnhandledException)
        Server.Transfer("ErrUnknown.aspx");
}

But the Application_Error event handler never gets called. Instead I get a runtime error page.

What do I have to do have Application_Error being called after an exception is thrown?

6
задан abatishchev 9 April 2011 в 11:29
поделиться