ASP.NET C#: Check to see if Session variable exists

Test to see if it DOES exist

if(Session["Name"]!=null){
     // It does exist, so do stuff!
}

OR test if it DOESN’T exist

if(Session["Name"]==null){
     // It doesn't exist!
}
, , ,

Leave a Reply

You must be logged in to post a comment.