Hey guys, In my code I want it to check if a session is equal to a particular value, in this case a string. I can output the session value no problem so I know it's there, but it doesn't work in my conditional statement. Here it is:
Code:
void Page_Load()
{
if (Session["user"].ToString() == "Chris") //I've also tried not using the ToString() method
{
message.Text = "It worked!";
}
else
{
message.Text = "It didn't";
}
}
After it runs I get: "It didn't"
If I output the value of the session, it shows: "Chris"
Any ideas on what's causing this?
Thanks guys,
Chris