title: How to exchange session variables between webmethods in asp.net webservices
body: <p>I have the following code to store session variable in one webmethod and retrieve it in other webmethod but the value displays null when i try to retrieve it.</p>
  
  <pre><code>[WebMethod(EnableSession = true)]
      [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
   public bool SubmitList1(string businessname )
      {
  
          Session["Company_Name"] = businessname;  
  
          SqlConnection con = new SqlConnection();
               .......
             .........
                  .........
  
    }
  </code></pre>
  
  <p>This will be my second webmethod where i am trying to retrieve the session variable</p>
  
  <pre><code>[WebMethod(EnableSession = true)]
      [ScriptMethod(ResponseFormat = ResponseFormat.Json)]
      public bool addresslisting()
      {
  
          string companyname = (string)Session["Company_Name"];// this particular value is displaying null
         ......
             ........
  
  }
  </code></pre>