I have an ASP project, in that one module is a separate MVC project. This module (which is hosted seperatly) I am displaying by using an IFrame. The issue is, if the Session expires from the MVC project, I need to redirect the page to the ASP project’s login page.
In my MVC project, I have this function:
public ActionResult Login(string reason)
{
switch (reason)
{
case BUMP_AUTHENTICATION_REQUIRED:
Response.AddHeader("X-Shell-Redirect", "AccessDenied");
ViewData["LoginMessage"] = "";
break;
case BUMP_SESSION_TIMEOUT:
Response.AddHeader("X-Shell-Redirect", "SessionTimeOut");
ViewData["LoginMessage"] = Strings.LoginSessionTimeoutMessage;
break;
default:
ViewData["LoginMessage"] = String.Empty;
break;
}
return View(); //Which return the login view of the MVC Project
}
How do I achieve this?
Here the question was how to pass message between iFrame page and the parent page. It is not possible to access any of the method or properties of parent page (it will show access denied error since both are in different domain). I got the solution using the “onMessage” Event. You can have more details of this from this page