There are three ways for doing that functionality which i m already using in my own project:
(1):Add this code to your every "ActionResult" method. By using this user can not go back by clicking backward icon of browser after "LogOut"
public void SetPageCacheNoStore()
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.AppendCacheExtension("no-store, must-revalidate");
Response.AppendHeader("Pragma", "no-cache");
Response.AppendHeader("Expires", "0");
}
(2):Use this code in every method at startup for checking Session destroyed or not.
if (Session["UserName"] == null)
{
return RedirectToAction("Login", "Account");
}
(3):Use this code in every view or in a "Partial" view like "Sidebar uses in every view".
string viewNames = Session["UserName"];
if (ViewNames == null)
{
<script src="~/Scripts/jquery-1.11.1.min.js"></script>
<script>
$(document).ready(function () {
window.location.href = "../Account/Login";
});
</script>
}
I hope by using all of these solutions your problem will be resolved.