[RESOLVED] How to check if a session variable exists. If (Session["LoggedIn"]) : C#[2005]
If I try it that way, I get can not convert to boolean. The only options I get when I type . to append a conversion does not include a conversion to boolean.
How can I check if a session variable exists before checking it's value. This causes me problems.
When I looked into convert to boolean in the MSDN. How do you read this? I don't understand it:
.NET Framework Class Library
Convert.ToBoolean Method (Boolean)
Returns the specified Boolean value; no actual conversion is performed.
[C#]
public statibool ToBoolean(
bool value
);
Re: How to check if a session variable exists. If (Session["LoggedIn"]) : C#[2005]
I tried:
if (!Session["LoggedIn"].Equals(null))
but getting not set to reference an instance of an object.
Re: How to check if a session variable exists. If (Session["LoggedIn"]) : C#[2005]
(Session["LoggedIn"]) !=null)