Kentico Xperience 13 documentation and ASP.NET Core

Most documentation about running Xperience applications under ASP.NET Core can be found in a dedicated section: Developing Xperience applications using ASP.NET Core. The rest of the documentation still applies, but some code samples and scenarios might need slight modifications for Core projects.

All major differences between the MVC 5 and Core platforms are summarized in Migrating to ASP.NET Core.

×

Configuring contact recognition

Most sites need to deal with contact recognition scenarios involving visitors with the same IP addresses. Visitors often come from shared networks, such as company or municipal networks. The contact recognition in Xperience is configured so that it best covers these scenarios – Xperience does not automatically assign contacts to anonymous visitors based on their:

  • Browser user agent
  • IP addresses

The system also remembers contacts until their cookies are deleted or until a different contact is determined for the visitor.

If this behavior does not suit your needs, developers can change it programmatically by creating and registering a custom implementation of the ICurrentContactProvider interface:

Important: Contact recognition and tracking occurs on the live site. Add the custom class to your front-end live site project (not the Xperience administration project).

Enterprise license required

Features described on this page require the Kentico Xperience Enterprise license.

  1. Open your live site project in Visual Studio.
  2. Create a class that implements the ICurrentContactProvider interface (we recommend adding the class within a custom Code Library).
  3. Implement your own logic for contact recognition.

    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();
        }
    }
  4. Register the class using the RegisterImplementation attribute.


Was this page helpful?