2

after logout if i click the back button i want to remain in the login page.... but this code wont work when i click back button it will redirect to the previous page. can some help me.

public virtual ActionResult Logout()
        {
            FormsAuth.SignOut();

            ActionResult homeAction = MVC.Account.Login();
            string logoffUrl = Url.Action(homeAction);

            string[] myCookies = Request.Cookies.AllKeys;
            foreach (string cookie in myCookies)
            {
                Request.Cookies[cookie].Expires = DateTime.Now.AddDays(-1);
                Response.Cookies[cookie].Expires = DateTime.Now.AddDays(-1);
                Response.Cookies.Add(Response.Cookies[cookie]);
                Request.Cookies.Add(Request.Cookies[cookie]);

            }
            HttpContext.Response.Cache.SetExpires(DateTime.UtcNow.AddDays(-1));
            HttpContext.Response.Cache.SetValidUntilExpires(false);
            HttpContext.Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
            HttpContext.Response.Cache.SetCacheability(HttpCacheability.NoCache);
            HttpContext.Response.Cache.SetNoStore();

            return RedirectToAction(homeAction);
        }

    }
tereško
  • 58,060
  • 25
  • 98
  • 150
Hasantha
  • 117
  • 1
  • 2
  • 10
  • probably this is what you are looking for http://stackoverflow.com/questions/1167890/how-to-programmatically-clear-outputcache-for-controller-action-method – maxlego Mar 15 '13 at 08:28

0 Answers0