Quantcast
Channel: Developer to developer
Viewing all articles
Browse latest Browse all 9076

How can I get MembershipUser from the PrincipalInfo.CurrentPrincipal.GetUserGuid

$
0
0

Hi,

I need to get the membership user and I have the EPiServer.Security.PrincipalInfo.CurrentPrincipal.GetUserGuid() in a variable. 

I tried Membership

Membership.GetUser(guidVariable);

but it returns null, since the GetUserGuid property is not the membership GUID.

After a lot of searches, I came up with this code:
Mediachase.Commerce.Customers.CustomerContext customerContext = new Mediachase.Commerce.Customers.CustomerContext();
Mediachase.Commerce.Customers.CustomerContact userContact = customerContext.GetContactById(modifierId);
return Membership.GetUser(userContact.ProviderUserKey.ToString());

which simes to work but
ProviderUserKey is Obsolete.

What shall I do?

Thanks in advance,

Ashkan

Viewing all articles
Browse latest Browse all 9076

Trending Articles