title: Getting error "Object reference not set to an instance of an object"
body: <p>In the below code i got an error "Object reference not set to an instance of an object" in the line of the 'if' condition. Can any one help me with what is wrong with my code.</p>
  
  <pre><code>public string MemberLogOut()
      {
          string ret = string.Empty;
          try
          {
              if (HttpContext.Current.Session.Count &gt; 0)
              HttpContext.Current.Session.Clear();
             ret="1";
          }
          catch (SqlException ex)
          {
              throw new Exception(ex.Message);
              ret="2";
          }
          return ret;
      }
  </code></pre>