More in this section

Forums / General Discussions / Login / Logout Status and Caching

Login / Logout Status and Caching

3 posts, 0 answered
  1. Boas
    Boas avatar
    13 posts
    Registered:
    30 Sep 2008
    21 Apr 2011
    Link to this post
    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" ?
  2. Abraham
    Abraham avatar
    29 posts
    Registered:
    11 Aug 2010
    21 Apr 2011
    Link to this post
    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
  3. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    27 Apr 2011
    Link to this post
    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

3 posts, 0 answered