First understand our purpose, my purpose is to verify whether the user login, that is session["UserName"]!=null OK
At the beginning of the time I wrote this, the results of the error, the warning as above the title of the errors, checked the half-day data did not understand what the problem
public class BasePage:System.Web.UI.Page {public basepage () } {this . IsLogin (); } public void IsLogin () { if (session["DateTime"] = = null) Response.Redirect ("/webform1.aspx");} }
Call base from the subclass. IsLogin () is normal but it's too much trouble to write every page, so you want to try to start the page
Try to verify that the OK code is as follows
public class BasePage:System.Web.UI.Page { protected override void OnInit (EventArgs e) {this . IsLogin (); } public void IsLogin () { if (session["DateTime"] = = null) Response.Redirect ("/webform1.aspx");} }
It's also clear why inside the constructor cannot be called
Know the Great god please answer next