Click here to Skip to main content
15,895,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How Disable Browser Back Button only after Logout in mvc3.net
Posted

Not all browsers allow that its better you put [Authorize] attribute on the methods so that after logout even if user hits back button he will be redirected to login page
 
Share this answer
 
v2
Comments
Member 10629036 25-Mar-14 0:31am    
Where i can declare [Authorize] method and how?
Add the following three tags in your html file, which clears the cache.
XML
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0″>


or see this,
http://stackoverflow.com/questions/14437987/how-disable-browser-back-button-only-after-logout-in-mvc3-net[^]

-KR
 
Share this answer
 
Comments
Member 10629036 25-Mar-14 0:45am    
Thank you....
JavaScript
<script language="javascript" type="text/javascript">

    window.history.forward();
</script>


Please Try this code in head section of html page.
i hope it will works.
 
Share this answer
 
v2
Comments
Member 11382088 24-Jul-15 17:28pm    
Perfect. Simple and safe logic.

Thanks!
Authorize is an attribute you can use it over a class or a Action

C#
[Authorize]
public ActionResult AdministratorsOnly()
{
    return View();
}


so now only authenticated user can access this
http://www.dotnet-tricks.com/Tutorial/mvc/R9QP060113-Securing-Asp.Net-MVC-Application-by-using-Authorize-Attribute.html[^]
 
Share this answer
 
Comments
Member 10629036 25-Mar-14 0:45am    
Thank you...
Always improve your answer, don't post multiple answers. Please delete this and add all these inside the first solution given by you.

Thanks,
Tadit

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