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"; }
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 "PHP"-page Response.Redirect("~/Category/PHP.aspx", false); } } }