Try our conversational search powered by Generative AI!

EpiServer automatically creates contact?


Hi there

I have a website where users can log in - This works fine. When they log in a contact is created containing the username (email address) in Full name, First name and email field. This is not done by our code.

Is this expected behaviour?



May 12, 2015 12:34


Yes, those should be expected, there's a section in your web.config:

    <profile enabled="true" defaultProvider="SqlProfileProvider" automaticSaveEnabled="false">
By default:

        <add name="Address" type="System.String" />
        <add name="ZipCode" type="System.String" />
        <add name="Locality" type="System.String" />
        <add name="Email" type="System.String" />
        <add name="FirstName" type="System.String" />
        <add name="LastName" type="System.String" />
        <add name="Language" type="System.String" />
        <add name="Country" type="System.String" />
        <add name="Company" type="System.String" />
        <add name="Title" type="System.String" />
        <add name="CustomExplorerTreePanel" type="System.String" />
        <add name="FileManagerFavourites" type="System.Collections.Generic.List`1[System.String]" />
        <add name="EditTreeSettings" type="EPiServer.Personalization.GuiSettings, EPiServer" />
        <add name="ClientToolsActivationKey" type="System.String" />
        <add name="FrameworkName" type="System.String" />
        <!-- ECF Start -->
        <add name="State" type="System.Int32" allowAnonymous="false" />
        <add name="FullName" type="System.String" allowAnonymous="true" />
        <add name="PreferredBillingAddress" type="System.String" />
        <add name="PreferredShippingAddress" type="System.String" />
        <add name="LastVisited" type="System.DateTime" />
        <!-- ECF End -->
        <add name="MarketId" type="System.String" allowAnonymous="true" />

May 12, 2015 14:42

Hi Q

Thanks a lot for your quick answer. Much appreciated!



May 13, 2015 8:45

This is kind of a bump, but I ran into the same "issue".

I experienced the same thing. I did something like this:

  • An unauthenticated user creates an order:
    var order = cart.SaveAsPurchaseOrder();
  • The user then gets to create an account:
    var username = Guid.NewGuid().ToString();
    var user = Membership.CreateUser(username, password, email, null, null, true, out status);
    var contact = CustomerContact.CreateInstance(user);
    contact.FirstName = address.FirstName;
    contact.LastName = address.LastName;
    contact.FullName = string.Format("{0} {1}", address.FirstName, address.LastName);
  • The user logs in:
    FormsAuthentication.SetAuthCookie(email, userModel.RememberMe); // Bug here
  • Another contact is created with the email as first name.
  • The order got connected to the new contact.

Ok, so as it turned out, the account was created due to the username passed to .SetAuthCookie(...) was wrong. Changing to this fixed my issue:

var username = Membership.GetUserNameByEmail(email);
FormsAuthentication.SetAuthCookie(username, rememberMe);

Oct 03, 2015 13:38
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.