quanmac
asked on
Session Data Problem
Hi there,
I have a website, when someone logs in, I create a Session variable for the id of the person who logged in. When they logout, I run these lines of code:
FormsAuthentication.SignOu t();
Response.Cookies.Clear();
Session.Clear();
Session.RemoveAll();
Context.Application.Remove All();
And when I log in as another user, the session variable does something weird. It logs in and the Session variable gets created, but when I run this code on my Navigation.ascx control:
<%
if (Session["EmpId"].ToString ().Equals( "10002"))
{
Response.Write("<b><a href='AdminPage.aspx'>Task Setup Page</a></b><br><br><br>") ;
}
%>
It doesn't catch that id, even though I logged in as EmpId 10002.
Anyone have any idea on why this is happening or how I can fix this?
I have a website, when someone logs in, I create a Session variable for the id of the person who logged in. When they logout, I run these lines of code:
FormsAuthentication.SignOu
Response.Cookies.Clear();
Session.Clear();
Session.RemoveAll();
Context.Application.Remove
And when I log in as another user, the session variable does something weird. It logs in and the Session variable gets created, but when I run this code on my Navigation.ascx control:
<%
if (Session["EmpId"].ToString
{
Response.Write("<b><a href='AdminPage.aspx'>Task
}
%>
It doesn't catch that id, even though I logged in as EmpId 10002.
Anyone have any idea on why this is happening or how I can fix this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Are you setting up the Session["EmpId"].= "10002" after successfully log in to the system?
ASKER
Yes, after the person logs in, they get forwarded to their profile page, and the page reads the Session["EmpId"] value
ASKER
if (Session["EmpId"].ToString == "10002")
That Worked
That Worked