页面生命周期 ---Scott Mitchell ---翻译:yocan

当一个请求到达ASP.NET Web服务器时,请求会被交给ASP.NET引擎处理,经历包括文件访问检查、用户Session恢复等多个阶段的处理管线。最后,引擎实例化对应的页面类并执行ProcessRequest()方法。
摘要由CSDN通过智能技术生成

 

Each time a request arrives at a Web server for an ASP.NET Web page, the first thing the Web server does is hand off the request to the ASP.NET engine. The ASP.NET engine then takes the request through a pipeline composed of numerous stages, which includes verifying file access rights for the ASP.NET Web page, resurrecting the user's session state, and so on. At the end of the pipeline, a class corresponding to the requested ASP.NET Web page is instantiated and the ProcessRequest() method is invoked (see Figure 1).

每当一个请求asp.net页面的请求到达web服务器时,web服务器首先做的是将这个请求转送到asp.net engine。Asp.net engine接到该请求后,会将该请求进行一系列的处理,其中包括验证被请求的asp.net页面的访问权;重建该用户的session状态等等。在这一系列处理的最后,实例化了与被请求的asp.net页面相对应的类被并且调用PrcessRequest()方法。

  
Figure 1. ASP.NET Page Handling
一:处理 asp.net 页面
This life cycle of the ASP.NET page starts with a call to the ProcessRequest() method. This method begins by initializing the page's control hierarchy. Next, the page and its server controls proceed lock-step through various phases that are essential to executing an ASP.NET Web page. These steps include managing view state, handling postback events, and rendering the page's HTML markup. Figure 2 provides a graphical representation of the ASP.NET page life cycle. The life cycle ends by handing off the Web page's HTML markup to the Web server, which sends it back to the client that requested the page.
Asp.net页面的生命周期起始于ProcessRequst()方法的调用。这个方法以初始化页面控件层次架构(page’s control hierarchy)开始(--译者注:下面将介绍什么是control hierarchy)。接下来,页面和它上面的服务器控件会经历一系列阶段,这些阶段对于执行asp.net web页面来说是十分必要的。这些阶段包括:管理viewstate,处理回发事件,和页面html代码的呈现。下面图片展示了asp.net 页面生命周期。这个生命周期结束于将web页面的html代码发到web服务器(服务器再将html代码发到请求该页面的客户端)
Note    A detailed discussion of the steps leading up to the ASP.NET page life cycle is beyond the scope of this article. For more information read Michele Leroux-Bustamante's Inside IIS & ASP.NET. For a more detailed look at HTTP handlers, which are the endpoints of the ASP.NET pipeline, check out my previous article on HTTP Handlers.
What is important to realize is that each and every time an ASP.NET Web page is requested it goes through these same life cycle stages (shown in Figure 2).
 
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值