Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            this.user = (User)Session["User"];
            this.fname = Path.GetFileNameWithoutExtension(Request.Path).Replace("Master", "");

            if (!Page.IsPostBack)
                this.user.UserLog(this.fname + ".aspx");

            try
            {
                if (!Page.IsPostBack && !user.CheckMenuPermission(this.fname))
                    redirect("/Main.aspx");
                else if (!this.user.CheckSession())
                    relogin("Session 錯誤!請再重新登入!");
                else
                {
                    Menu1.Items[0].Text = "主菜單";
                    Menu1.Items[0].Selectable = false;
                    if (!Page.IsPostBack)
                        Menu1 = user.UserMenu(Menu1);
                }
            }
            catch (NullReferenceException)
            {
                relogin("請先登入系統!");
            }
        }