Welcome 微信登录

首页 / 网页编程 / ASP.NET / ASP.NET页面生成详解

ASP.NET页面生成详解2011-10-04 博客园 Lance.Liang当我们访问ASP.NET网页时,如果是第一次访问,系统会编译相应的网页,编译好的内容会存入 “WINDOWSMicrosoft.NETFrameworkversionTemporary ASP.NET Files项目名称随机数随机数”中 ,下面我们通过详细分析这个编译好的内容来学习aspx页面的整个生成过程。

首先我们先制作一个简单的aspx页面

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

<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:DropDownList ID="DropDownList1"
runat="server">
<asp:ListItem>ListItem1</asp:ListItem>
<asp:ListItem> ListItem2</asp:ListItem>

</asp:DropDownList>
</div>
<asp:Button ID="Button1" runat="server" Text="Button" />
</form>
</body>
</html>

当这个页面第一次被访问时,一个包含控件层级结构的类会自动的被创建,这个层级结构可以简单抽 象成如下图: