how to check Session is empty or not

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ganesh22
    Banned
    New Member
    • Sep 2007
    • 81

    how to check Session is empty or not

    Hi,
    Iam using like this
    string gs=Session["site"].ToString();
    but in my code Session is empty so its giving some runtime error
    now i want to give condition that if session is empty i want to do another process how to give condition if session is empty
  • dip_developer
    Recognized Expert Contributor
    • Aug 2006
    • 648

    #2
    use

    [CODE=cs]

    {
    if (!(Session("sit e") == "")) {

    //do your needful

    }
    }
    [/CODE]

    Comment

    • Plater
      Recognized Expert Expert
      • Apr 2007
      • 7872

      #3
      Well there's this, for if it's a new session
      Code:
      Session.IsNewSession
      And
      Code:
      Session.Keys.Count

      Comment

      Working...