Is there an easy way to redirect the entire page (not just a partial view) to the login page after the session expires?
I tried the following solutions, but can't get it to work:
My problem is that the partial view is redirected to the login page, and not to the whole page (the same problem as in the links).
controller
[HttpPost]
public PartialViewResult LogPartialView(string a, int? b, string c, string d, int? e, string f)
{
if (Roles.IsUserInRole(WebSecurity.CurrentUserName, "Admin"))
{
if (Session["myID"] == null)
{
ExpireSession();
}
return PartialView("LogPartialLayout", model);
}
I wanted to return Redirect ("~ /") if myID is null, but it does not work, since it expects a partial view.
: "System.Web.Mvc.RedirectResult" "System.Web.Mvc.PartialViewResult"
public void ExpireSession()
{
Session.Abandon();
WebSecurity.Logout();
Response.Redirect("~/");
}
