0

I am trying to pass a session variable from one page to another using this code in asp.net:

HttpContext.Current.Session["FacebookID"] = id;

This works just fine with Firefox and Chrome, but when I try to grab that value from another page in Internet Explorer 9 it won't work, I even tried it in compatibility mode. It just returns null.

Does anyone have any suggestions as to why my session variables won't store?

Meyer Denney
  • 796
  • 1
  • 11
  • 34

2 Answers2

3

Have you got Cookies turned off in IE? If so, it wont be able to track your session unless you change the session state to cookieless...

LDJ
  • 6,896
  • 9
  • 52
  • 87
1

I see you have got an answer but for anyone else who has the same the problem:
It may be a Privacy Preferences (P3P) issue. In that case you have to add a P3P header, something like...

HttpContext.Current.Response.AddHeader("p3p", "CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\""); 

Read Peter Bromberg's blog to find out more: http://petesbloggerama.blogspot.se/2007/08/aspnet-loss-of-session-cookies-with.html

Björn
  • 3,098
  • 2
  • 26
  • 40