November Happy Hour will be moved to Thursday December 5th.

Asp.Net Idenity CurrentContact is Null

Vote:
 

Hi, I am trying to add commerce to a default Alloy installation, I have been referencing the QuickSilver repo as a guide.

I created the registration /login process and this all works fine. However when I try to get the CurrentContact using the below code it is always null. 

var customerContact = CustomerContext.Current.CurrentContact;

Has anyone experienced similiar issues? or can explain why this would be?

Thanks

Paul

#183941
Oct 24, 2017 20:41
Vote:
 
var contact = PrincipalInfo.CurrentPrincipal.GetCustomerContact();

Will get or create and link the contact to the current principal usernamme. 

#183947
Oct 25, 2017 0:58
Vote:
 

One possible cause is that commerce isn't initialized properly and then CustomerContext.Current won't get populated.

#183984
Oct 25, 2017 15:25
Vote:
 

If you added "Commerce", by installing the EPiServer.Commerce package and adding the required database, it should properly initialized. 

Make sure PrincipalInfo.CurrentPrincipal is not null. If it null, then .CurrentContact will return null. 

#184408
Oct 26, 2017 9:49
Vote:
 

Hi Guys, Thanks for the comments.

@Mark - I tried your suggestion, however this still returned null.

I am going to investigate this more, but thank you for your comments.

#184410
Oct 26, 2017 10:02
Vote:
 

Hey Paul (and others),

Did you end up finding a fix for your isssue? I'm seeing the same on a client's install and trying to see what's causing the disconnect. They are also using Identity (rather than Membership), and I also checked out Quicksilver to make sure I'm not missing something critical, and the code looks pretty identical regarding customer contact creation. It's running Commerce 11.

Thanks!

#185898
Dec 05, 2017 23:00
Vote:
 

Hi Maxim.

This is a kind of question that I'd suggest to contact developer support service. When we have all information we need to investigate it would be much faster than just guessing

#185900
Dec 06, 2017 8:24
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.