title: How can I access session in a webmethod?
body: <p>Can i use session values inside a <a href="http://msdn.microsoft.com/en-us/library/byxd99hx(v=vs.90).aspx"><code>WebMethod</code></a>?</p>
  
  <p>I've tried using <code>System.Web.Services.WebMethod(EnableSession = true)</code> but i can't access Session parameter like <a href="http://msdn.microsoft.com/en-us/library/byxd99hx(v=vs.90).aspx#vbtskusingwebmethodattributeenablesession">in this example</a>:</p>
  
  <pre><code>    [System.Web.Services.WebMethod(EnableSession = true)]
      [System.Web.Script.Services.ScriptMethod()]
      public static String checaItem(String id)
      { 
          return "zeta";
      }
  </code></pre>
  
  <p>here's the JS who calls the webmethod:</p>
  
  <pre><code>    $.ajax({
          type: "POST",
          url: 'Catalogo.aspx/checaItem',
          data: "{ id : 'teste' }",
          contentType: 'application/json; charset=utf-8',
          success: function (data) {
              alert(data);
          }
      });
  </code></pre>