public class PageFiltert : System.Web.UI.Page
{
public PageFiltert()
{
//
//TODO: 在此处添加构造函数逻辑
//
}
protected override void OnInit(EventArgs e)
{
//context.PostRequestHandlerExecute += new EventHandler(this.Application_beginRequest);
this.Load += new System.EventHandler(Application_beginRequest);
base.OnInit(e);
}
protected void Application_beginRequest(Object sender, EventArgs e)
{
if (Session["userName"]==null)
{
HttpContext.Current.Response.Redirect("login.aspx");
}
}
}
时间: 2024-10-21 15:18:20