开发者

ASP.NET: Clear client output cache on log out

开发者 https://www.devze.com 2023-01-07 22:12 出处:网络
My web client requires client-side output caching since it makes use of its own Back and Forward buttons (which basically just call the browser back/forward buttons).

My web client requires client-side output caching since it makes use of its own Back and Forward buttons (which basically just call the browser back/forward buttons).

The issue I'm having, however, is (of course) when the user signs out of the app. The client-side output cache remains so anyone can click the "back" button and it appears to be signed in again. I've researched a few solutions, but most involve server-side output caching or no output caching at all.

I've had success with server caching and HttpResponse.RemoveOutputCacheItem, but unfortunately I 开发者_StackOverflow中文版need the client side caching.

Is it at all possible to clear this client side output cache upon logging out?


Is there a reason you wish to remove the cache explicitly?

The best way to check user log in is to add a config to the current directory, eg: /section1/web.config

<?xml version="1.0"?>
<configuration>

  <system.web>
    <authorization>
      <deny users="?"/>
    </authorization>
  </system.web>

</configuration>

In the main web.config you can set the redirect page if the user isn't validated.

Log the users with system.web.security membership. When log out is pushed, you can either use the membership loggedintemplate or explicitly log them out using:

FormsAuthentication.SignOut();

This way you ensure security and keep you page cache.

0

精彩评论

暂无评论...
验证码 换一张
取 消