Unhandled Exceptions and Maximum request length exceeded

Discussion in 'ASP .Net' started by =?Utf-8?B?Q2h1Y2sgUA==?=, Oct 31, 2007.

  1. I have an HttpModule used for Unhandled Exception processing. The module
    monitors both
    application.Error += new EventHandler(OnError); //regular UHE
    AppDomain.CurrentDomain.UnhandledException += new
    UnhandledExceptionEventHandler(OnUhe); //UHE on threads


    If I do a throw, the first one gets it.
    If I do a throw in a thread, the second one gets it.

    In each case I process the exception as follows:
    HttpContext.Current.Response.Clear();
    HttpContext.Current.Response.ClearContent();
    HttpContext.Current.Response.Write( a web page with pretty message);
    HttpContext.Current.Response.Flush();
    HttpContext.Current.Server.ClearError();
    HttpContext.Current.Response.End();

    This works fine for theads and throws.

    When I was testing a file upload control and trying to upload a file greater
    than
    <httpRuntime maxRequestLength="4096" />
    Both events fire and I get a generic web page that says:
    "The connection to the server was reset while the page was loading."

    How come I get both events and how come my pretty error page is not
    displayed? I put in break points and the page creation stuff does get hit.
    Actually the page creation code gets hit twice.

    thanks,
     
    =?Utf-8?B?Q2h1Y2sgUA==?=, Oct 31, 2007
    #1
    1. Advertising

  2. =?Utf-8?B?Q2h1Y2sgUA==?=

    bruce barker Guest

    in http there is no way to tell the browser to stop sending the request
    other than closing the connection. as the browser could not complete the
    request, it does not bother reading the response.

    -- bruce (sqlwork.com)

    Chuck P wrote:
    > I have an HttpModule used for Unhandled Exception processing. The module
    > monitors both
    > application.Error += new EventHandler(OnError); //regular UHE
    > AppDomain.CurrentDomain.UnhandledException += new
    > UnhandledExceptionEventHandler(OnUhe); //UHE on threads
    >
    >
    > If I do a throw, the first one gets it.
    > If I do a throw in a thread, the second one gets it.
    >
    > In each case I process the exception as follows:
    > HttpContext.Current.Response.Clear();
    > HttpContext.Current.Response.ClearContent();
    > HttpContext.Current.Response.Write( a web page with pretty message);
    > HttpContext.Current.Response.Flush();
    > HttpContext.Current.Server.ClearError();
    > HttpContext.Current.Response.End();
    >
    > This works fine for theads and throws.
    >
    > When I was testing a file upload control and trying to upload a file greater
    > than
    > <httpRuntime maxRequestLength="4096" />
    > Both events fire and I get a generic web page that says:
    > "The connection to the server was reset while the page was loading."
    >
    > How come I get both events and how come my pretty error page is not
    > displayed? I put in break points and the page creation stuff does get hit.
    > Actually the page creation code gets hit twice.
    >
    > thanks,
    >
     
    bruce barker, Nov 1, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jacky Kwok
    Replies:
    2
    Views:
    3,591
    Mark1969
    Jun 24, 2005
  2. =?Utf-8?B?Y21heQ==?=
    Replies:
    8
    Views:
    31,685
    SilentSojourner
    Apr 2, 2012
  3. Chris Hayes
    Replies:
    8
    Views:
    9,439
    DDaanV
    Oct 21, 2010
  4. Chris Hayes
    Replies:
    0
    Views:
    674
    Chris Hayes
    Jul 27, 2005
  5. Lloyd Dupont

    Maximum request length exceeded.

    Lloyd Dupont, Jan 19, 2006, in forum: ASP .Net
    Replies:
    3
    Views:
    22,323
    justin_yj
    Oct 29, 2010
Loading...

Share This Page