Allow users to register separately for different sites

Tom Troughton asked on May 21, 2015 15:06

I see Kentico users have email and username. I'm planning to use email address as username which I'm sure I can find a way to do. What I'm wondering is, if the Kentico instance has multiple sites which each register their own users and have entirely separate user bases, is it possible to allow the same person to register separately on different sites with the same email address? If so, will their two user accounts be tracked by analytics as a single contact?

Correct Answer

Rui Wang answered on May 21, 2015 19:35

Yes, if you use email as the username, then yes, you cannot have two different users using the same address for username.

But if it's the same user which resisted on site A, then you add site B to that user's profile by doing. UserSiteInfoProvider.AddUserToSite(userId, siteId);

0 votesVote for this answer Unmark Correct answer

Recent Answers

Petar Kozjak answered on May 21, 2015 15:25


first you can assign user to a site during registration. So if your registers to Site A, assign site A, if he resisters on both sites you can assign both site A and site B.

And now for tracking you can use global contact to track users for both sites. Also you can use some condition to perform contact merging. But for contact you will need EMS license.

As I know you can customize reports so there won't be a problem to replicate this.

1 votesVote for this answer Mark as a Correct answer

Rui Wang answered on May 21, 2015 16:27

If you plan to use API to create your own registration process, you can add a step which is to check if the email (username) exist already. Then assign that username to the second site. If the username doesn't exist, then create a new account.

private bool AddUserToSite()
    // Get the user
    UserInfo user = UserInfoProvider.GetUserInfo("MyNewUser");
    if (user != null)
        int userId = user.UserID;
        int siteId = SiteContext.CurrentSiteID;

        // Save the binding
        UserSiteInfoProvider.AddUserToSite(userId, siteId);

        return true;

    return false;
1 votesVote for this answer Mark as a Correct answer

Brenden Kehren answered on May 21, 2015 16:52

In addition to Petar and Rui, you will need to think about using the email address as the username. If you allow duplicate email address to register then you need to ensure that each user is assigned a site otherwise you could run into problems if you have no site assigned and the same email.

2 votesVote for this answer Mark as a Correct answer

Tom Troughton answered on May 21, 2015 17:47

Thanks guys. Very helpful.

@Rui, this is kind of what I was getting at. UserInfoProvider.GetUserInfo takes a username argument. If I use email address for username I presume this means I can't have two different users on two different sites using the same email address for username?

Or do I take it from Brenden's point, that UserInfoProvider operates in the context of the current site in which can it'll only pull users from the current site?

Thanks as always for your advice.

0 votesVote for this answer Mark as a Correct answer

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