1

Possible Duplicate:
Session variable is lost on RedirectToAction in IE

I'm using MVC3 and the application is called from an external PHP website (form - post).
I've got this:

Internet Explorer 9 (9.0.8112.16421 update 9.0.3)

Home controller - method Index(string A, string B, string C) is called.
Values are fine and are stored on the session (Session["A"], ...). Redirect to Login controller.

Login Controller - method Index() is called.
Session values are just lost (null)


Internet Explorer 8, Chrome & more

Home controller - method Index(string A, string B, string C) is called.
Values are fine and are stored on the session (Session["A"], ...). Redirect to Login controller.

Login Controller - method Index() is called.
Everything works fine (values are stored on the session)


Notes

This ONLY happens when the form is inside a PHP page on another host (maybe another OS but can't say for sure) with IE 9 but while inside our intranet host (IIS) or a cloud host (also IIS) there is no problem at all (even with IE9).

I've created a sample code on the view as bellow:

@{
   if (Session != null)
   {
       foreach (var item in Session.Keys)
       {
           ViewContext.Writer.Write(String.Format("{0}<br />", item));
       }
   }
   else
   {
       ViewContext.Writer.Write("Session = null");
   }
}

Using IE8, Chrome and others, all keys are there.
But using IE9 there is nothing at all, but the session is not null too. It's just empty.


Any help?

Community
  • 1
  • 1
Anderson Matos
  • 3,132
  • 1
  • 23
  • 33
  • After a deep search I've managed to find answers to the same problem, as follows: http://stackoverflow.com/questions/7562911/session-variable-is-lost-on-redirecttoaction-in-ie http://stackoverflow.com/questions/389456/cookie-blocked-not-saved-in-iframe-in-internet-explorer Moderator, please close my question. Sorry for the duplicate. – Anderson Matos Nov 01 '11 at 15:48

2 Answers2

0

You could maybe just tell IE9 to emulate IE8:

<meta http-equiv="X-UA-Compatible" content="IE=8" />
Paul Tyng
  • 7,924
  • 1
  • 33
  • 57
  • I don't have views so there is no place where I can place this code. Question will be closed because I've managed to find a solution. – Anderson Matos Nov 01 '11 at 15:46
0

Answer found.

After a deep search into google I've found:

Session variable is lost on RedirectToAction in IE

Cookie blocked/not saved in IFRAME in Internet Explorer

Both get into the same core problem. Frames. After removing the frames from the page variables worked just fine.

Community
  • 1
  • 1
Anderson Matos
  • 3,132
  • 1
  • 23
  • 33