Caching issue with User
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))
SecurityManager.DeleteAuthCookies();
//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;
userManager.SaveChanges();
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!
Jarrod
Hi Jarrod,
Turn off your page caching from the title and properties. which will cause this issue.
Thanks,
Kannan.