comparing session variable value to a string

fatih_alsan

New Member
I am comparing the session variable to a string to check if the login type is administrator or not. Code i am using :\[code\]if (Session["loggedInUsername"] == null) { btnLogin.Text = "Sign In"; lblWelcome.Text = "Welcome!"; hypManageRestaurants.Enabled = false; hypManageReviews.Enabled = false; hypPostReviews.Enabled = false; } else { if (Session["loggedInUserType"] == "Administrator") { hypManageRestaurants.Enabled = true; hypManageReviews.Enabled = true; hypPostReviews.Enabled = true; } else { hypManageRestaurants.Enabled = false; hypManageReviews.Enabled = false; hypPostReviews.Enabled = true; } lblWelcome.Text = "Welcome " + Session["loggedInUsername"]; btnLogin.Text = "Sign Out"; }\[/code\]So first I am checking if any user has logged in or not. If the user logs in successfully, the session variable "loggedInUsername" will have the value of the username. If the "loggedInUsername" session variable is not empty, it will check "loggedInUserType" session variable for the type of the logged in user.Here comes the weird thing, the value of the "loggedInUserType" is exactly "Administrator" without the "", at the if function where I am comparing the session variable to the string "Administrator" is being skipped and goes to the else.All session variables are getting values when the user logs in.Below is the data which I am using to login and this record is the only record which have a type of "Administrator".link to imageIs there any other method to compare a session variable to a string
 
Top