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?
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.