ASP.NET 页面生命周期的更改
2.0、3.0 和 4.0 框架中 ASP.NET 网页的页面生命周期是否有任何变化?
Have there been any changes to the page lifecycle of an ASP.NET web page in 2.0 vs 3.0 vs 4.0 frameworks?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
就生命周期事件而言,例如
Init
、PreLoad
、Load
、PreRender
等。我认为这些仍然是各个版本都一样。您可以使用 MSDN 上的这篇页面生命周期文章来检查差异。只需在右侧切换框架版本即可查看每个版本。
您可能还需要查阅.NET Framework 3.5 版中的新增功能
AFAIK 框架中最重要的变化与 C# 有关,而不是 ASP.NET。
我已经将许多 ASP.NET 2.0 网站和 Web 应用程序转换为 v3.5,并且可以告诉您,除了一些过时的警告之外,这些项目运行良好,并且可以重构以在几分钟内删除警告。
我发现 2 和 3.5 之间有用的 ASP.NET 框架的一些主要区别是:
Head
标记中使用ContentPlaceHolder
控件时,我可以继续,但这已经偏离主题了:)
希望这会有所帮助。
In terms of lifecycle events such as
Init
,PreLoad
,Load
,PreRender
, etc. I think these remain the same across versions.You can check differences using this Page Life Cycle article on MSDN. Simply switch framework versions on the right to review each one.
You may also want to consult What's New in the .NET Framework Version 3.5
AFAIK the most significant changes in the framework have to do with C#, not ASP.NET.
I've converted many ASP.NET 2.0 Website and Web Applications to v3.5 and can tell you that beyond a few obsolete warnings, the projects run fine and can be refactored to remove the warnings within minutes.
A few major differences in ASP.NET framework that I've found useful between 2 and 3.5 is:
ContentPlaceHolder
controls within theHead
tag.I could go on but this is getting off-topic :)
Hope this helps a little.
您将看到 IIS 6 和 IIS 7.0 页面生命周期比 2.0,3.0 或 4.0。
You will see more changes between IIS 6 and IIS 7.0 page lifecycles than between 2.0, 3.0 or 4.0.
我可以看到区别只是增加了一个名为 PreInitComplete 的事件。对于 .NET3.0 (3.5),我们总共有 11 个事件,而对于 .NET 4.0,则有 12 个事件
I could see that the difference is just additional of one event called PreInitComplete. In case of .NET3.0 (3.5) we have total of 11 events and in case of .NET 4.0 it is 12 events