c# - After logout,how to redirect user to login page when he/she will click back button of browser in ASP.NET MVC3 -


i working on asp.net mvc3 project c# , sql server 2008 backend.

mu issue is:

on logout controller doing

session.abandon();   httpcontext.response.cookies.set(new httpcookie("cookie-name") { value = string.empty }); 

due this, session cleared , cookie cleared.

now want if user click on browser's button, he/she should redirected login page.

how can this?

try:

if(!user.identity.isauthenticated) {     redirecttoaction("index", "home"); } 

and use [authorize] data annotation on required actions. should doing pages require user logged in anyway.

hope helps.


Comments