惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
Engineering at Meta
Engineering at Meta
博客园 - 聂微东
博客园 - Franky
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
L
LangChain Blog
WordPress大学
WordPress大学
H
Help Net Security
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Y
Y Combinator Blog
Blog — PlanetScale
Blog — PlanetScale
MyScale Blog
MyScale Blog
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
有赞技术团队
有赞技术团队
Apple Machine Learning Research
Apple Machine Learning Research
云风的 BLOG
云风的 BLOG
博客园 - 【当耐特】
P
Proofpoint News Feed
D
DataBreaches.Net

博客园 - winkingzhang

Build 2016概览 WinRT开发系列之编程语言:功能和效率 WinRT开发系列之基础概念:WinRT不是…… VS2010 Extension实践(3)——实现自定义配置 [VS2010 Extension]PowerExtension.GoToDefinition VS2010 Extension实践(2) VS2010 Extension实践 如何通过反射调用带有ref或者out的参数的方法[迁移] Win7硬盘安装和移动硬盘访问出错的修复办法[迁移] zt. Windows Mobile开发文章收藏 [WPF]在Style中设置ToolTip的问题分析 [WPF]RadioButton在Group的Header区部分不响应鼠标选择的bug分析 WPF模式思考 (zt) How to Get IIS Web Sites Information Programmatically Visual Studio 调试器 Application Request Routing and the IIS 7.0 Web Management Service Reference Resources for MOSS and WSS FileSystemWatcher事件多次触发的解决方法 CAS and Native Code
ASP.NET Application Life Cycle
winkingzhang · 2008-05-28 · via 博客园 - winkingzhang

Original Post at http://blogs.msdn.com/tom/archive/2008/05/27/asp-net-application-life-cycle.aspx

ASP.NET Application Life Cycle

Have you ever wondered about all the stages that an ASP.NET request goes through?  Ever wonder why it is such a performance hit to have a wildcard mapping to map all extensions on your web server to ASP.NET?  This information corresponds to IIS 5.0 and 6.0.  For information on the life cycle in IIS 7.0, see ASP.NET Application Life Cycle Overview for IIS 7.0.  You can also check out the ASP.NET Page Life Cycle Overview for information on what happens once a page is run.

User requests a resource

A request comes into the web server and it will check to see what is mapped to handle the request.  ASP.NET is an ISAPI extension under the web server.

ASP.NET receives the first request for an application

ASP.NET will first create the application domain for this application.  These allow each application to be isolated from each other.  ASP.NET then compiles all the top-level items in the application, if required, including the App_Code folder.

ASP.NET core objects created for the request

ASP.NET will create the Request, Response, and Context objects for the request.  This includes browser information, cookies, headers and everything that the server will respond back to the client with.

HttpApplication is assigned to the request

The application is started by creating the HttpApplication object, taking into account the Global.asax file if it exists.  At this stage, ASP.NET will create any configured modules, such as SessionStateModule to handle Session.

HttpApplication pipeline

The following events occur:

  1. Validate the request – checking for malicious markup
  2. Perform URL mapping
  3. BeginRequest event
  4. AuthenticateRequest event
  5. PostAuthenticateRequest event
  6. AuthorizeRequest event
  7. PostAuthorizeRequest event
  8. ResolveRequestCache event
  9. PostResolveRequestCache event
  10. Find the requested resource, if it is a Page, compile the page
  11. PostMapRequestHandler event
  12. AcquireRequestState event
  13. PostAcquireRequestState event
  14. PreRequestHandlerExecute event
  15. Call ProcessRequest on the HttpHandler
  16. PostRequestHandlerExecute event
  17. ReleaseRequestState event
  18. PostReleaseRequestState event
  19. Response filtering
  20. UpdateRequestCache event
  21. PostUpdateRequestCache event
  22. EndRequest event
  23. PreSendRequestHeaders event
  24. PreSendRequestContent event

Hopefully this will give you a little perspective on all of the different times that you can hook into a request and the different things you can act on.  There are additional things you can do, such as Application_Start events in the global.asax file.  For those and some nice pictures of some of the above data, take a look at the MSDN page here.