views:

209

answers:

2

When i try to check Session["userId"] != null why i get this message Possible unintended reference comparrison; to get value comparrison; cast left hand side to string Any suggestion....

A: 
        if(Session["userId"]!=null)
        {

        }

works just fine for me

Sky Sanders
+2  A: 

Session[key] returns an object, not a string - you should be casting it to string rather than relying on implicit casting or ToString() functionality.

slugster
He speaks the truth.
runrunraygun