Due to the way my server is set up, I have a session variable set to identify a user when they go onto the site (it's an internal only website).
In the global.asax page, I have:
in the Session_Start method. It appears to work fine (tested it with an output statement).
Now I'm trying to call the session variable in a SELECT statement and I'm getting an error that says "CS0103: The name 'Session' does not exist in the current context". From what I read, this means that I haven't declared it, but I wasn't aware I needed to declare a Session variable. Is that the case? If so, where do I declare it?
The code that is causing the error is:
It's the last line that causes the error code to show up.
In the global.asax page, I have:
Code:
Session["CISUserID"] = Request.Form["UserID"];
in the Session_Start method. It appears to work fine (tested it with an output statement).
Now I'm trying to call the session variable in a SELECT statement and I'm getting an error that says "CS0103: The name 'Session' does not exist in the current context". From what I read, this means that I haven't declared it, but I wasn't aware I needed to declare a Session variable. Is that the case? If so, where do I declare it?
The code that is causing the error is:
Code:
comm.CommandText = "SELECT SystemUsers.UserID, SystemUsers.TeamID, NTLogon, " +
"DevLogon, LastName, FirstName, Email, Transit, " +
"SystemManagers.UserID, Manager, StartDate FROM SystemUsers, " +
"SystemManagers WHERE SystemUsers.ManagerID = " +
"SystemManagers.ManagerID AND NTLogon = " + Session["CISUserID"];
It's the last line that causes the error code to show up.