Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
After logout while clicking on browser back button redirecting to the previous page in asp.net mvc.how to sole it and my code is below
C#
[AllowAnonymous]
     public ActionResult LogOff()
     {
             FormsAuthentication.SignOut();
             Session.Abandon();
             Session.Clear();
             Session.RemoveAll();


}

C#
public ActionResult Index()
{
        return View();
}

What I have tried:

i have tried by using this code it's not working?
   protected void Application_BeginRequest()
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
            Response.Cache.SetNoStore();
        }
Posted
Updated 26-Feb-16 0:44am
Comments
F-ES Sitecore 26-Feb-16 5:50am    
You'll need to disable caching on your site which will adversely affect the performance just to stop someone going "back" and seeing something they've already seen?

This is one of those non-problems that is best to ignore.

1 solution

All actions should be decorated with attribute [Authorize] or you could do it global level.

Google [Authorize] at global in MVC you will find enough information
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900