private void rendreUserMenu(LoginLib login) { if (login.IsUserLoggedIn()) { MenuItem BrukerMenu = new MenuItem(); BrukerMenu.Text = "Bruker"; Menu.Items.Add(BrukerMenu); MenuItem MeldUserMenu = new MenuItem(); MeldUserMenu.Text = "Meldinger"; MeldUserMenu.NavigateUrl = "~/User/Meldinger2.aspx"; MenuItem BrukerSokMenu = new MenuItem(); BrukerSokMenu.Text = "Søk i brukere"; BrukerSokMenu.NavigateUrl = "~/User/vennesok.aspx"; MenuItem rootUserMenu = new MenuItem(); rootUserMenu.Text = "Logout"; Menu.Items.Add(rootUserMenu); BrukerMenu.ChildItems.Add(MeldUserMenu); BrukerMenu.ChildItems.Add(BrukerSokMenu); } else { MenuItem ToggleLoginMenuItem = new MenuItem(); ToggleLoginMenuItem.Text = "Login"; ToggleLoginMenuItem.NavigateUrl = "javascript:Toggel('LoginDiv');"; Menu.Items.Add(ToggleLoginMenuItem); } }
protected void Page_Load(object sender, EventArgs e) { LoginLib login = new LoginLib(); if (!IsPostBack) { //Full Callback if (!login.IsUserLoggedIn()) { Response.Redirect("/StartPage.aspx"); } else { Normal.FillData(); } } else { //Async Callback } int qUserId; string userIdString = Request.QueryString["UserId"]; Int32.TryParse(userIdString, out qUserId); ModifySelf.Visible = false; if (ManageDB.UserHasPermission("Gaymer_EditUser", login.GetUserID()) || login.GetUserID() != qUserId) { ModifySelf.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { LoginLib login = new LoginLib(); if (login.IsUserLoggedIn()) { //LogOutBtn.Visible = true; //LogOutBtn.Enabled = true; //Must run last for logged in users on every page, meaning before this block closes //login.CreateNewCookie(); } else { //LogOutBtn.Visible = false; //LogOutBtn.Enabled = false; } rendreMenu(login); }