title: Unable to use session in ASP.Net vNext Project
body: <p>I have an ASP.Net vNext project that uses Session. But I am getting this error while trying to get/set values in the session.</p>
  <blockquote>
  <p>An exception of type 'System.InvalidOperationException' occurred in Microsoft.AspNet.Http.Core.dll but was not handled in user code</p>
  <p>Additional information: Session has not been configured for this application or request.</p>
  </blockquote>
  <p>Here's my controller method:</p>
  <pre><code>    [AllowAnonymous]
      [HttpGet(&quot;/admin&quot;)]
      public IActionResult Index()
      {
          if (Context.Session.GetString(&quot;UserName&quot;) == null) // error thrown here
          {
              return RedirectToAction(&quot;Login&quot;);
          }
  
          return View();
      }
  </code></pre>
  <p>I have added the KVM package <code>&quot;Microsoft.AspNet.Session&quot;: &quot;1.0.0-beta3&quot;</code> in my <code>project.json</code> file as well and have configured my application to use session via my <code>Startup.cs</code> like so:</p>
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      // code removed for brevity
      services.AddCachingServices();
      services.AddSessionServices();
  }
  
  public void Configure(IApplicationBuilder app)
      {
          app.UseMvc();
          app.UseInMemorySession(configure: s =&gt; s.IdleTimeout = TimeSpan.FromMinutes(30));
      }
  </code></pre>
  <p>I have looked at the vNext documentation on Github but it does not provide much information about ASP.Net sessions. What am I doing wrong?</p>