Try Now
More in this section

Forums / Developing with Sitefinity / Caching issue with User

Caching issue with User

2 posts, 0 answered
  1. Jarrod
    Jarrod avatar
    7 posts
    11 May 2012
    07 Jun 2012
    Link to this post
    Hi there!

    I am facing a problem with caching whereby when I logged in to my page, it does not reflect that the user is logged in. It takes awhile for the cache to register the logged-in user. Can anyone help me identify any area which I've done wrongly?

    P/S: Everything was done programmatically.

    Login authentication code:
    UserManager userManager = UserManager.GetManager();
            if (userManager.ValidateUser(txtUserID.Text, txtPassword.Text))
                //if you need to get the user instance use the out parameter
                Telerik.Sitefinity.Security.Model.User userToAuthenticate = null;
                var loginReason = SecurityManager.AuthenticateUser(userManager.Provider.Name, txtUserID.Text, txtPassword.Text, false, out userToAuthenticate);

                if (loginReason == UserLoggingReason.Success)
                    userManager.Provider.SuppressSecurityChecks = true;
                    System.Web.Security.FormsAuthentication.SetAuthCookie(txtUserID.Text, false);

                    //Redirect to secure page

    Check for logged-in user:
    public static bool IsUserLogin()
            bool hasLogin = false;

            // get the current identity
            var identity = Telerik.Sitefinity.Security.Claims.ClaimsManager.GetCurrentIdentity();

            // get information about the user from the properties of the ClaimsIdentityProxy object
            var userName = identity.Name;
            var userId = identity.UserId;

            if (userId.ToString() != "00000000-0000-0000-0000-000000000000")
                hasLogin = true;

            return hasLogin;

    Thanks alot in advance!
  2. Kannan
    Kannan avatar
    1 posts
    17 Sep 2013
    01 Oct 2013 in reply to Jarrod
    Link to this post
    Hi Jarrod,

    Turn off your page caching from the title and properties. which will cause this issue.

2 posts, 0 answered