继承BasePage,在BasePage中验证登陆

解决方案 »

  1.   

    protected override void OnPreInit(EventArgs e)
            {
                HttpContext.Current.User = Authorization.GetPrincipal();
                if (this.User == null || !this.User.Identity.IsAuthenticated)
                {
                    this.RedirectToLogin();
                    Response.End();
                }
                if (NeedAuth)
                {
                    this.CheckAuthorization();
                }
                base.OnPreInit(e);
            }
    可以通过HttpContext.Current获取session
      

  2.   

    我有点不太清楚 有service 但是显示的时候不是在浏览器显示的 访问 service可以从浏览器中获取数据
      

  3.   

    自己用Dictionary<string,string>实现