Hello guys ,
can someone please tell me how can i get the current user ID , I have managed to get the current user like this :
var currentUser = EPiServerProfile.Current;
But it doesnt have the id in it
Just get the Membership.GetUser.it will contain userid.
why you trying to get the user id.
You should use PrincipalInfo.CurrentPrincipal instead
Quan it doesnt retrieve the current user actually Membership.getUser worked at first but when i used it somewhere else it didn't , long story short Membership.GetUser is not working.
and what i want is the email and the username and the id of the current User
EpiserverProfile.Current seem to retrieve the username and the email but not the ID :/
You can get user name from there. Then if you are using Membership provider then Membership.GetUser to find that user.
HttpContext.Current.User might give you the same information
Quan can you please show me how can i Get the user name the user email and the user Id ( as GUID ) using PrincipalInfo.CurrentPrincipal
For user id:
For user name and email:
var customerContact = PrincipalInfo.CurrentPrincipal.GetCustomerContact();
Then you get customerContact, that contains name and email.