子类的Page_Load没有被触发
public partial class BasePage : Page { protected override void OnLoad(EventArgs e) { // 业务逻辑 base.OnLoad(e); } public string BaseUrl { get; set; } }public partial class Login : BasePage { protected override void Page_Load(object sender, EventArgs e) { -- 此处程序都没有执行到 if (!IsPostBack) -- 断点在这里 { string strUserID = string.Empty; if (Request.Params["userid"] != null) { strUserID = Request.Params["userid"].ToString(); } } } }
public class BasePage:Page { public BasePage() { this.Load += new EventHandler(CheckSession_Load); //PublicMethods.ReturnClientPosition(this); } //protected override void OnInit(EventArgs e) //{ // this.Load += new EventHandler(CheckSession_Load); // base.OnInit(e); //} //protected override void OnLoad(EventArgs e) //{ // //一些要在Page_Load的时候执行的代码 // base.OnLoad(e); //} /// <summary> /// 用来判断session是否还保持 /// </summary> protected void CheckSession_Load(object sender, EventArgs e) { PublicMethods.IsSessionActive(this); } }