How I use session in static funcs in mvc 6
<p>this line not working</p>

<pre><code>System.Web.HttpContext.Current.Session.RemoveAll();
</code></pre>

<blockquote>
  <p>Severity  Code    Description Project File    Line    Source  Suppression State
  Error CS0234  The type or namespace name 'Web' does not exist in the
  namespace 'System' (are you missing an assembly reference?)   MVC6.DNX
  Core 5.0  26</p>
  
  <p>Edited</p>
  
  <p>i created this</p>
</blockquote>

<pre><code> public class MySession
    {
        private  readonly IHttpContextAccessor _httpContextAccessor;
        private  ISession _session =&gt; _httpContextAccessor.HttpContext.Session;

        public  MySession(IHttpContextAccessor httpContextAccessor)
        {
            _httpContextAccessor = httpContextAccessor;
        }

        public  void Set(string key,object o)
        {
            _session.Set(key,o);
        }

        public  void Get(string key)
        {
            var message = _session.GetString(key);
        }
    }

  public static class SessionEx
    {
        public static void Set(this ISession session, string key, object value)
        {
            session.SetString(key, JsonConvert.SerializeObject(value));
        }

        public static T Get&lt;T&gt;(this ISession session, string key)
        {
            var value = session.GetString(key);

            return value == null ? default(T) : JsonConvert.DeserializeObject&lt;T&gt;(value);
        }
    }
</code></pre>

<blockquote>
  <p>How i use the set of session method from static func</p>
</blockquote>

<pre><code>  public static class SessionHandler
    { 
       public static void SetSessionId(long? id)
        {
          new MySession().Set("id", id);
        }
}
</code></pre>