Click here to Skip to main content
15,899,313 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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"),
               //middlename = (identity as ClaimsIdentity).FirstOrNull("middlename"),
               //lastname = (identity as ClaimsIdentity).FirstOrNull("lastname"),
               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
Posted
Updated 3-Jan-17 21:15pm
v3
Comments
Maciej Los 4-Jan-17 2:10am    
Sorry, but your question is no clear. Please, be more specific and provide more details about your issue. Remember, we haven't access to your screen and we can't read in your mind.
The part of your question, which confuse me, is: "recently inserted value".
Member 12931758 5-Jan-17 8:41am    
when i update my profile it not reflect in our dashboard where i placed image icon and user name
profile image is updated but my dashboard is not updated
how can i solve this problem
Karthik_Mahalingam 2-Feb-17 0:02am    
Always use  Reply  button, to post Comments/query to the user, so that the user gets notified and responds to your text.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900