When I try to check Session["userId"] != nullwhy I get this message Possible unintended reference comparrison; to get value comparrison; cast left hand side to stringAny suggestion ....
Session["userId"] != null
Possible unintended reference comparrison; to get value comparrison; cast left hand side to string
Session[key]returns an object , not a string - you should distinguish it from a string, and not rely on implicit casting or the ToString () function.
Session[key]
if(Session["userId"]!=null) { }
works great for me
if (String.IsNullOrEmpty(s)) { return "is null or empty"; } else{ return String.Format("(\"{0}\") is not null or empty", s); }
/ * true if the value parameter is null or an empty string (""); otherwise false. * /