title: Web Api 2 Session
body: <p>I cannot get session data from while in web api 2. I have verified that the cookie is sending in fiddler.</p>
  
  <p>I know that web api 2 best practice is to be stateless, but due to requirements on a project it is now necessary to be state-full.</p>
  
  <p>I have tried this link.
  <a href="https://stackoverflow.com/questions/19758221/webapi-2-attribute-routing-enable-session-state">WebAPI 2 attribute routing enable session state</a></p>
  
  <pre><code>var session = SessionStateUtility.GetHttpSessionStateFromContext(HttpContext.Current)
  </code></pre>
  
  <p>With the above solution I am getting a null exception on that function.</p>
  
  <p>I also tried replicating the way of doing this the way you would in the old web api by modifying the requesthandler from the route, but that is not available in web api 2. </p>
  
  <p>I currently set some session variables in mvc5. This works and the session stays, but anytime I am trying to use session while in web api 2 the below is null.</p>
  
  <pre><code>HttpContext.Current.Session
  </code></pre>