Login / Logout Status and Caching

Posted by Community Admin on 03-Aug-2018 12:32

Login / Logout Status and Caching

All Replies

Posted by Community Admin on 21-Apr-2011 00:00

Hi

I've a small side on which the content updates very rare.
So i wanted to activate the output caching .

But when I activate the output caching (not matter it client or default, or both) i 've some issues concerning the login / logout status.

Forexample user have to click twice Logout before they can see that they are logged out.

I tried the LoginStatus Widged and the "big" LoginControl. both with same behavior.

I tried also to set an redirect to an other page instead of relaod but this didn't help.

Any hints on how to improve the handling ? is there a way to do something like "on login or logout clear cache for this user" ?

Posted by Community Admin on 21-Apr-2011 00:00

If you solve Boas' request it might help me also.  This almost seems like a bug.  I've set the permissions on a page to not allow anonymous users.  It works at first when I am not logged in, redirecting me to the login page.  Then, after logging in I can see the page.  After I logout however, I can still see the page.  That and the login status control still makes it look like I am logged in.

Abraham

Posted by Community Admin on 27-Apr-2011 00:00

Hi Abraham,

Generally you can implement cache substitution control which should solve your issue

sample

<asp:substitution id="Substitution1"
      methodname="GetCurrentUser"
      runat="server">
    </asp:substitution>


 
public static string GetCurrentUser(HttpContext context)
  
      if (context.User.Identity.IsAuthenticated)
          return context.User.Identity.Name;
      return "annonymous";
  

otherwise you should disable the caching on this page.

Regards,
Ivan Dimitrov
the Telerik team

This thread is closed