Exemplo n.º 1
0
        /// <summary>
        /// 权限过期得重新登录
        /// </summary>
        /// <param name="e"></param>
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);
            if (System.Web.HttpContext.Current != null && !this.DesignMode)
            {

                CurrentAuthor = Session["cacheKey"] as Authorization.Authorization;
                if (CurrentAuthor == null
                    || CurrentAuthor.GetAuthorizeMenus() == null
                    || CurrentAuthor.GetAuthorizeMenus().Count <= 0
                    || CurrentAuthor.GetAuthorizeUsers() == null)
                {
                    string ParentURL = indexUrl;
                    //string ParentURL = Request.ApplicationPath + indexUrl;
                    System.Web.HttpContext.Current.Response.Write("<script language='javascript'>if(parent.AlertAndgoBack!=null ) { parent.AlertAndgoBack('" + ParentURL + "') ;} else {alert('您当前没有权限浏览本页面,请重新登录!'); window.location.href='" + ParentURL + "';};</script>");
                    Response.End();
                }

                CurrentUser = CurrentAuthor.GetAuthorizeUsers();
            }

        }