tags:

views:

41

answers:

0

When I use the [Authorize] attribute I can't get session data that I stored before. For example:

public ViewResult Index()
{
   // do some stuff
   Session["Test"] = "Hi StackOverflow!";
}

And then I try to get it in another action, but with the [Authorize] attibute:

[Authorize]
public ViewResult Test()
{
   // do some stuff
   if(Session["Test"] == null) 
   { 
      //do some more stuff
   }
}

Session["Test"] is always null. But if I remove the attribute it works. Can someone help me?

I'm instancing Session["Test"] in Session_Start.