Preventing Kentico 10 from recognizing contacts and merging one user's contact into another

Will Connell asked on December 11, 2017 11:17

We are having a problem following a site upgrade (from Kentico 8 up to Kentico 10.0.45) where user contacts appear to be being incorrectly merged into other users' contacts and deleting contact records. I believe this is happening when the users are sharing a computer and it is picking up the contact cookie from a different user. This is a big problem for the site, as the user's contact record is used to store important information and to determine what features of the site the user has access to.

I contacted Kentico Support, and they pointed me in the direction of this article, which gives the bare bones of a class for configuring contact recognition - https://docs.kentico.com/k10/on-line-marketing-features/configuring-and-customizing-your-on-line-marketing-features/configuring-contacts/configuring-contact-recognition

Could anybody please give me any pointers as to how best to flesh out the class below to prevent Kentico picking up a contact cookie from a previous user and merging the contact into that? I presume I have to reproduce the existing functionality of all three methods. Is there anywhere I can see the original code for those methods? I doubt I need to make any changes to the SetCurrentContact method.

I'd really appreciate any assistance. Thanks in advance.

using System;

using CMS;
using CMS.Membership;
using CMS.ContactManagement;

[assembly: RegisterImplementation(typeof(ICurrentContactProvider), typeof(CustomCurrentContactProvider))]
/// <summary>
/// Summary description for CustomCurrentContactProvider
/// </summary>
public class CustomCurrentContactProvider : ICurrentContactProvider
{
    public ContactInfo GetCurrentContact(IUserInfo currentUser, bool forceUserMatching)
    {
        // Implement your contact recognition logic
        throw new NotImplementedException();
    }

    public ContactInfo GetExistingContact(IUserInfo currentUser, bool forceUserMatching)
    {
        // Implement your contact recognition logic
        throw new NotImplementedException();
    }

    public void SetCurrentContact(ContactInfo contact)
    {
        // Implement your logic for storing information about the current contact
        throw new NotImplementedException();
    }
}

   Please, sign in to be able to submit a new answer.