locked
ASP.NET page life cycle events and HTTP Handler RRS feed

  • Question

  • User-814694070 posted

    Would like to know wirth respect to ASP.NET page lifecycle and HTTP Handlers, if i have HTTP handler and in ProcessRequest if i use context.ApplicationInstance.CompleteRequest() , will Page Life cycle events will excute after this.

    If it executes, how to stop executing these.

    Thanks,

    Thursday, April 18, 2013 1:45 AM

Answers

  • User1779161005 posted

    From the docs:

    Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event.

    Internally all this does is set a flag, so that once the IIS pipeline moves to the next step it will jump to the EndRequest step. So if you call this from within the Page lifecycle it looks as if that will continue processing the rest opf the page methods. 

    This is different behavior than Response.End() -- that API calls CompleteRequest() and throws an exception to prevent further processing.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 18, 2013 8:25 AM
  • User1779161005 posted

    Page lifecycle events are only fired if the http handler derives from System.Web.UI.Page base class.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 19, 2013 12:36 AM

All replies

  • User1779161005 posted

    From the docs:

    Causes ASP.NET to bypass all events and filtering in the HTTP pipeline chain of execution and directly execute the EndRequest event.

    Internally all this does is set a flag, so that once the IIS pipeline moves to the next step it will jump to the EndRequest step. So if you call this from within the Page lifecycle it looks as if that will continue processing the rest opf the page methods. 

    This is different behavior than Response.End() -- that API calls CompleteRequest() and throws an exception to prevent further processing.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 18, 2013 8:25 AM
  • User-814694070 posted

    Hi,

    Thanks for replying.

    As per my understanding, once HTTP Application starts processing, at first HttpModule events then HTTP Handler event and then ASP.NET Page life cycle events will fire.

    So is that, in HTTPHandler ProcessRequest event, if we call CompleteRequest, the rest of the PageLie Cycle events will not be fired.

     

    Thanks

     

    Friday, April 19, 2013 12:13 AM
  • User-814694070 posted

    Hi,

    Question might be irrelavant, i want to process .aspx extension files which are nothing but of ASP.NET files, as per the docuementaion related to HTTP Handlers, ProcessRequest method will return the code that produces the output for the handler.

    so the rest of the Page life cycle events will not be fired.

    Thanks

    Friday, April 19, 2013 12:28 AM
  • User1779161005 posted

    Page lifecycle events are only fired if the http handler derives from System.Web.UI.Page base class.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 19, 2013 12:36 AM