问题描述
usingSystem;///<summary>///dddddddddddddddddddddddddddd///</summary>publicclassAdminSession:System.Web.UI.Page{publicAdminSession(){////TODO:Addconstructorlogichere//}protectedoverridevoidOnInit(EventArgse){base.OnInit(e);this.Init+=newEventHandler(this.BasePage_Init);}protectedvoidBasePage_Init(objectsender,EventArgse){Response.Write("init");}privatestringConStr(){return"connectionstring";}}然后在ASPX里面usingSystem;usingSystem.Data;usingSystem.Configuration;usingSystem.Collections;usingSystem.Web;usingSystem.Web.Security;usingSystem.Web.UI;usingSystem.Web.UI.WebControls;usingSystem.Web.UI.WebControls.WebParts;usingSystem.Web.UI.HtmlControls;publicpartialclassAdmin_default:AdminSession{protectedvoidPage_Load(objectsender,EventArgse){Response.Write("Successfully");}}输出结果是Successfullyinit,为什么继承类后执行?我想让它先运行,如何实现?也就是先运行我的继承类代码我再想在Page_Load里面加入权限,如何在继承类实现验证,想在Page_Load里面传参数实现,谢谢
解决方案
解决方案二:
base.BasePage_Init(e)
解决方案三:
try{usingMicrosoft.Win32;}catch{rollbackdata}finnaly{return;}