public static CurentUserInfo GetUser(this IIdentity identity)
{
CurentUserInfo currentuser = new CurentUserInfo
{
roles = (identity as ClaimsIdentity).FirstOrNull("roles"),
userid = (identity as ClaimsIdentity).FirstOrNull("userid") == null ? 0 : long.Parse((identity as ClaimsIdentity).FirstOrNull("userid")),
aspUserid = (identity as ClaimsIdentity).FirstOrNull("aspUserid"),
schoolId = (identity as ClaimsIdentity).FirstOrNull("schoolId") == null ? 0 : long.Parse((identity as ClaimsIdentity).FirstOrNull("schoolId")),
Name = (identity as ClaimsIdentity).FirstOrNull("Name"),
firstName = (identity as ClaimsIdentity).FirstOrNull("firstName"),
displayname = (identity as ClaimsIdentity).FirstOrNull("displayname"),
schoolName = (identity as ClaimsIdentity).FirstOrNull("schoolName"),
Email = (identity as ClaimsIdentity).FirstOrNull("Email"),
ImageIcon = (identity as ClaimsIdentity).FirstOrNull("ImageIcon"),
};
return currentuser;
}
internal static string FirstOrNull(this ClaimsIdentity identity, string claimType)
{
var val = identity.FindFirst(claimType);
return val == null ? null : val.Value;
}
What I have tried:
how to update our identity value to recently inserted value and get those without using relogin.
all the variable like firstname and lastname here fetch during login and stay remain the same.
if we are update something then its not affected on that.
if we are login again then its updated.
please can you tell me how i fix this problem.
how can i update identity value here