test - page life cycle
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace ASPNET_LifeCycle
{
public partial class _Default : System.Web.UI.Page
{
string info = "";
protected void Page_PreInit(object sender, EventArgs e)
{
base.Load += new EventHandler(_Default_Load);
info += "Page_PreInit!是构造函数之后的第一个要执行的代码.";
}
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
info += "<br />OnPreInit!";
}
protected void Page_Load(object sender, EventArgs e)
{
info += "<br />Page_Load!";
}
void _Default_Load(object sender, EventArgs e)
{
info += "<br />_Default_Load!";
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
info += "<br />OnLoad!";
this.Label1.Text = info;
}
protected void Page_PreRender(object sender, EventArgs e)
{
this.Label1.Text = info;
}
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
this.Label1.Text = info;
}
protected override void Render(HtmlTextWriter writer)
{
base.Render(writer);
this.Label1.Text = info;
}
private void Method()
{
HttpApplication app = new HttpApplication();
Application[0] = "ssdfgg";
; Session[0] = "aaa";
}
}
}
This posting is provided "AS IS" with no warranties, and confers no rights.
浙公网安备 33010602011771号