今天整理了一下ASP执行过程,从.net页码的执行周期开始做一个详细的了解.我重写了页面的绝大多数方法.然后加载执行.所得的顺序如下。

方法是每个重写的事件中都输出一个字符,按字符打印出来的先后判断事件执行的顺序。如有不正确之处,还请路过的各位不吝赐教)

前台代码

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>

<body>
    <form id="form1" runat="server">
    <div>
    <asp:button runat="server" text="Button" onclick="Unnamed1_Click" />
    </div>
    </form>
</body>
</html>
View Code

相关文章: