This session solution in this forum shows all the hiden links
when the session expires
example if the user is online and finally closes browser when next the user comes back online and opens the browser the expired session doesn't redirect the user to login becuase of that all the hiden Admin and Staff hiden panes shows all page making all users to have access to all links.
static string username = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
if (!this.Page.User.Identity.IsAuthenticated)
{
System.Web.Security.FormsAuthentication.RedirectToLoginPage();
}
else
{
if (Session["Department"] != null && Session["Department"].ToString() == "Staff")
{
pnlAdmin.Visible = false;
}
else if (Session["Department"] != null && Session["Department"].ToString() == "Admin")
{
pnlStaff.Visible = false;
}
}
}
protected void ButLogout_Click(object sender, EventArgs e)
{
System.Web.Security.FormsAuthentication.SignOut();
Response.Redirect(ResolveUrl("~/Account/Login.aspx"));
}