0

First,I did not access HttpContext.Current.Session, and I added in below statement in global.asax.

  protected void Application_PostAuthenticateRequest(object sender, EventArgs e)
  {
     System.Web.HttpContext.Current.SetSessionStateBehavior(SessionStateBehavior.Required);
  }

After that, i could access HttpContext.Current.Session and i set a value in Session object.

But I cant access my value in another action.

For example :

Account/Login

Session["User"]="User";

Account/BlaBla

Session["User"] is null;

Why couldn't i do it ?

Mustafa Tığ
  • 101
  • 1
  • 12
  • 1
    Possible duplicate of [Accessing Session Using ASP.NET Web API](http://stackoverflow.com/questions/9594229/accessing-session-using-asp-net-web-api) – Divyang Desai Nov 23 '16 at 06:32
  • Possible duplicate question http://stackoverflow.com/questions/9594229/accessing-session-using-asp-net-web-api – Huske Nov 23 '16 at 06:32
  • No it is not dublicate question, you see i tried these answers but did not solve my problem, i can access HtttpContext.Current.Session object i can set a Session but i can not acces value in another action. – Mustafa Tığ Nov 23 '16 at 06:40

0 Answers0