HTTPModule Event Execution Order?

不羁的心 提交于 2019-11-26 06:18:07

问题


Does anyone know of a site or page, or know the order of execution for the events of the HTTPApplication class for HTTPModule event execution?

I found the MSDN Documentation for all of the events, but it doesn\'t show a list of process steps and I haven\'t been able to find one.


回答1:


Maybe this helps

http://support.microsoft.com/kb/307985/en-us/

An HttpApplication class provides a number of events with which modules can synchronize. The following events are available for modules to synchronize with on each request. These events are listed in sequential order:

  1. BeginRequest
  2. AuthenticateRequest
  3. AuthorizeRequest
  4. ResolveRequestCache
  5. AcquireRequestState
  6. PreRequestHandlerExecute
  7. PostRequestHandlerExecute
  8. ReleaseRequestState
  9. UpdateRequestCache
  10. EndRequest

The following events are available for modules to synchronize with for each request transmission. The order of these events is non-deterministic.

  • PreSendRequestHeaders
  • PreSendRequestContent
  • Error

See the article for full info.




回答2:


MSDN Library documentation:

  • ASP.NET Application Life Cycle Overview for IIS 5.0 and 6.0
  • ASP.NET Application Life Cycle Overview for IIS 7.0

Here are the events (in bold) and other steps in the request pipeline for ASP.NET 4.0:

  1. Validate the request, which examines the information sent by the browser and determines whether it contains potentially malicious markup.
  2. Perform URL mapping, if any URLs have been configured in the UrlMappingsSection section of the Web.config file.
  3. Raise the BeginRequest event.
  4. Raise the AuthenticateRequest event.
  5. Raise the PostAuthenticateRequest event.
  6. Raise the AuthorizeRequest event.
  7. Raise the PostAuthorizeRequest event.
  8. Raise the ResolveRequestCache event.
  9. Raise the PostResolveRequestCache event.
  10. [IIS 5.0/6.0] Based on the file name extension of the requested resource (mapped in the application's configuration file), select a class that implements IHttpHandler to process the request. If the request is for an object (page) derived from the Page class and the page needs to be compiled, ASP.NET compiles the page before creating an instance of it. [IIS 7.0] Raise the MapRequestHandler event. An appropriate handler is selected based on the file name extension of the requested resource. The handler can be a native-code module such as the IIS 7.0 StaticFileModule or a managed-code module such as the PageHandlerFactory class (which handles .aspx files).
  11. Raise the PostMapRequestHandler event.
  12. Raise the AcquireRequestState event.
  13. Raise the PostAcquireRequestState event.
  14. Raise the PreRequestHandlerExecute event.
  15. Call the ProcessRequest method (or the asynchronous version IHttpAsyncHandler.BeginProcessRequest) of the appropriate IHttpHandler class for the request. For example, if the request is for a page, the current page instance handles the request.
  16. Raise the PostRequestHandlerExecute event.
  17. Raise the ReleaseRequestState event.
  18. Raise the PostReleaseRequestState event.
  19. Perform response filtering if the Filter property is defined.
  20. Raise the UpdateRequestCache event.
  21. Raise the PostUpdateRequestCache event.
  22. [IIS 7.0] Raise the LogRequest event.
  23. [IIS 7.0] Raise the PostLogRequest event.
  24. Raise the EndRequest event.
  25. Raise the PreSendRequestHeaders event.
  26. Raise the PreSendRequestContent event.

Note: The MapRequestHandler, LogRequest, and PostLogRequest events are supported only if the application is running in Integrated mode in IIS 7.0 and with the .NET Framework 3.0 or later.




回答3:


The accepted answer is out-of-date. Here is the list of events in the order they are raised according to the documentation:

  1. BeginRequest

  2. AuthenticateRequest

  3. PostAuthenticateRequest

  4. AuthorizeRequest

  5. PostAuthorizeRequest

  6. ResolveRequestCache

  7. PostResolveRequestCache

    After the PostResolveRequestCache event and before the PostMapRequestHandler event, an event handler (which is a page that corresponds to the request URL) is created. When a server is running IIS 7.0 in Integrated mode and at least the .NET Framework version 3.0, the MapRequestHandler event is raised. When a server is running IIS 7.0 in Classic mode or an earlier version of IIS, this event cannot be handled.

  8. PostMapRequestHandler

  9. AcquireRequestState

  10. PostAcquireRequestState

  11. PreRequestHandlerExecute

  12. PostRequestHandlerExecute

  13. ReleaseRequestState

  14. PostReleaseRequestState

  15. UpdateRequestCache

  16. PostUpdateRequestCache

  17. LogRequest

  18. PostLogRequest

  19. EndRequest



来源:https://stackoverflow.com/questions/441421/httpmodule-event-execution-order

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!