asp.net页面的生命周期 [英] life cycle of asp.net page

查看:94
本文介绍了asp.net页面的生命周期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,
我正在寻找以下简单的解释

Hello friends,
I''m looking for simple explanation for the following

ASP.NET page life cycle



用图进行说明会很有帮助.

在此先感谢



Explanation with diagram will be helpful.

Thanks in advance

推荐答案

如果将其放入google,排名第一的是Microsoft

http://msdn.microsoft.com/en-us/library/ms178472.aspx [ ^ ]
If you put that into google, the no 1 hit is from Microsoft

http://msdn.microsoft.com/en-us/library/ms178472.aspx[^]


在不同的资源中我们可以获得不同的答案,但是根据我的说法,asp.net页面的生命周期是

1.Page PreInit事件

在这种情况下,如果您想对母版页进行动态更改,则可以在此事件中进行所有操作.

2.Page_Init事件

在此,所有asp.net服务器控件属性都已初始化.

3.Page_Load事件

所有控件均已加载到aspx页面中

4.Page_PreRender和Page_Render事件

所有控件都在服务器中处理,并重定向到浏览器可理解的代码(即html)到客户端并执行页面.

5.Page_unload

所有控件均已卸载.

还有另一种方式,我们可以看到第一次客户端使用.aspx页发出请求.

请求的页面转到aspx引擎并生成MSIL.

MSIL由clr
执行
输出进入缓存

然后o/p给需要的客户.

当客户端第二次发出请求时,以上过程均未完成. clr看到,如果它在缓存中,它将重定向.因此,Percormance增加了.


希望对您有所帮助.
in different resources we can get different answers but according to me asp.net page life cycle is

1.Page PreInit event

In this event if you want to do dunamic changes to master page you can do all in this event.

2.Page_Init event

In this all asp.net server control properties are initialized.

3.Page_Load event

All controls are loaded into aspx page

4.Page_PreRender and Page_Render events

All controls are processed in server and redirect to browser understandable code(i.e html) to client and page is executed.

5.Page_unload

All controls are unloaded.

And another way we can see that first time client makes request with .aspx page.

The requested page goes to aspx engine and generate MSIL.

MSIL is Executed by clr

Output goes into cache

and then o/p gives to requsted client.

when the client makes request 2nd time the above process is all not done. clr sees that if it is in cache it will redirect .So Percormance is increased.


I hope it helps you.


也请尝试此链接

页面生命周期视频教程 [
try this link also

Page Life Cyle Video Tutorial[^]


这篇关于asp.net页面的生命周期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆