コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // If the user are visiting this page, and the
            // session-variables are empty - send the user
            // to the login-page instead
            NotLoggedInHandler nlh = new NotLoggedInHandler();
            nlh.SendToLoginPage();

            // Set the page-variable for
            // this specific page, in the masterpage
            ((GeneralDesign)Page.Master).CurPage = "Logout";
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // If the user are visiting this page, and the
            // session-variables are empty - send the user
            // to the login-page instead
            NotLoggedInHandler nlh = new NotLoggedInHandler();
            nlh.SendToLoginPage();

            // If the username-session-variable isn't empty ...
            if (HttpContext.Current.Session["usrnme"] != null)
            {
                // ... and the usergroup-session-varible not holds the string "admin" ...
                if (HttpContext.Current.Session["usrngrp"].ToString().ToLower() != "admin")
                {
                    // ... redirect the user to the "music"-page
                    Response.Redirect("~/Category/Music.aspx", false);
                }
            }
        }