Logout from MVC

前端 未结 4 438
南旧
南旧 2021-01-07 09:56

I have a MVC application and I have to logout. To logout from the application I have created a link on te master page

[ 

        
4条回答
  •  萌比男神i
    2021-01-07 10:47

    The pages you visit in your browser are cached depending upon your caching settings in the browser. You need to prevent caching in ASP.net MVC so that they are not cached by the browser. After you do that try clearing your browsers cache and try loading the page again. Logout and try the back button. You should get a message saying that the page no longer exists or something.

    There are many ways of preventing your ASP.net pages from getting cached in the browser. One such way is to do this before the page is rendered.

    this.Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1))
    this.Response.Cache.SetCacheability(HttpCacheability.NoCache)
    this.Response.Cache.SetNoStore()
    

提交回复
热议问题