I have a problem in a EPiServer Commerce project that I have set up. I am trying to load a CustomerContact by MembershipUser but get an error for no apparant reason.
Calling the code:
MembershipUser user = Membership.GetUser(userName);
Mediachase.Commerce.Customers.CustomerContact contact = Mediachase.Commerce.CustomerContext.GetContactForUser(user);
I get the following error on line 2.
{"Specified cast is not valid."}
at Mediachase.Commerce.Customers.CustomerContext.<>c__DisplayClass5a.<GetContactForUser>b__59() at Mediachase.Commerce.Customers.CustomerContext.GetCachedValue(String key, TimeSpan timeout, Func`1 cachedValueGetter) at Mediachase.Commerce.Customers.CustomerContext.GetContactForUser(MembershipUser user)
I am running EpiServer CMS 6 R2. On top of that a custom platform has been built. In the custom platform there is a custom role provider and a custom membership provider. Both the custom role provider and a custom membership provider are multiplexed with more standard providers.
I have made sure I have a valid DataContext and SqlContext. The user is a standard System.Web.Security.MembershipUser, with membership provided by the custom membership provider.
If I disable the custom role and membership providers everything works, with the exception that I can't log in the the way I am supposed to.
I have looked at the code inside of GetContactForUser and GetCachedValue (decompile) but there is no obvious casting going on.
{Mediachase.Commerce, Version=5.2.377.1, Culture=neutral, PublicKeyToken=6e58b501b34abce3}
I am running EpiServer CMS 6 R2. On top of that a custom platform has been built. In the custom platform there is a custom role provider and a custom membership provider. Both the custom role provider and a custom membership provider are multiplexed with more standard providers.
I have made sure I have a valid DataContext and SqlContext. The user is a standard System.Web.Security.MembershipUser, with membership provided by the custom membership provider.
If I disable the custom role and membership providers everything works, with the exception that I can't log in the the way I am supposed to.
I have looked at the code inside of GetContactForUser and GetCachedValue (decompile) but there is no obvious casting going on.
Why could I be getting this error?
Any hint would be appriciated.