DotNetNuke - Having same usernames across multiple portals on the same installation

You might be well aware that DNN allows you to create multiple Portals based on the same physical installation and the database. It even allows the users to be managed independently across Portals, restricting users to the Portal they registered for.

However, there is a less publicized aspect of this feature of DNN. Let's see it in action before I desribe it theoretically. For this, you would need a DNN installation with atleast 2 portals on it (the Parent/Child status of the Portals does not matter). If you dont' have it, first create  a test installation with 2 portals. Keep the registration public on both. I will call them http://p1.com, and http://p2.com, for this example.

Browse to http://p1.com, and click the Register link. Create a dummy username say "test", and give any password (but remember it). Let's say your password is "master". Login to the portal http://p1.com with your username, test. You see everything works normally.

Now logout of p1, and browse to http://p2.com. Again click the Register link. Give "test" as the username, but give some other password, let's say "second". When you click Register, notice that DotNetNuke shows you an errors, and does not create your account. No matter, what you do, if you want to register with username "test" on http://p2.com, the password provided should be "master" (the one we provided for p1).

Now the above leads to a very major conclusion. There is an implicit built-in assumption in DotNetNuke, that 2 users trying to register with the same username on 2 portals on the same installation, are actually the same human (or bot, if your site is not protected against automated registrationsWink).

Thus, 2 different people cannot use the same username on different portals of the same installation.

There are some other extentions also to this aspect. Although DotNetNuke allows you to maintain your Profile per portal, but your username, password, first name, and last name are uniquel maintained across multiple portals, meaning that if you change them on one portal, the changes are automatically reflected in the other portals.

This last point is important. If you change your pssword on one portal (or username/first name/last name), they are changed across all portals.

Physically this is so, because these values are not stored per portal but once in the Users/aspnet_Membership tables.

Logically, this makes sense to me, as I would normally expect different portals on the same installation to be related to each other in some way.

Comments

Thanks Rahul for this information.  I am building multiple member sites on the same installation and a number of users will need access on more than one site.  I am sure they will complain if they had to have a separate username for each one.  Now, if I just be sure to set them up with the same password, they can access each of their sites with the same user name.  This was very helpful.  Regards, Clark.

rahul's picture

Hi Clark, I would like to insist one point described in the post above: Only Username/Password/First Name/Last Name are synchronized across portals, but not any other profile property.

This means that if you have a Profile Property let's say, Date Of Birth on multiple portals off the same physical DNN installation, the user would be able to specify different values for this property on each portal.

In my case, this was undesirable for one of my client's portals. I had to create a new Profile Provider as the solution, which ensured that Profile Properties are also synchronized across portals, and change in value of a property on one portal are reflected across others.

Hi!

I just read your article and to my surprise i wasn't able to create sites for my customers with their own admin (login "admin" password "blabla")

I use a single instance of DNN and am looking for a module that enables me to use a single instance but for every portal created a separate user thingy.

so: i login in p2 and am able to create another admin account.

Although i can see why one login for multiple portals is great, i don't want it to work that way and i also dont want to install separate instances for every set of users.

Do you know a module (or something) that makes this possible?

Paul

rahul's picture

Hi Paul, you can still do what you need to by creating admin users with different usernames on different portals (and not try to use "admin" as username itself on all portals).

I dont think any module can ever allow you to assign same usernames to different users on different portals belonging to same DNN installation owing to how DNN internally stores user information (a portal user is just an abstration DNN built over ASP.NET's built in user handling mechanisms which is what actually stores the user password and other critical information for the user, passwords are not stored per portal but once in a single table).

Hi Rahul,

"I had to create a new Profile Provider as the solution, which ensured that Profile Properties are also synchronized across portals, and change in value of a property on one portal are reflected across others."

We have this same problem.  Is your solution available to us?

Thanks,
Chris

rahul's picture

Hi Chris, yes, I would be happy to share my solution. Please note it was built for DNN 4.9 and hasn't been maintained since then (although I strongly believe it should continue to work fine with DNN 6 also with minimal changes if any, as not much has changed in DNN core as regards handling users and profiles between these versions). I will post the related Visual Studio project here in sometime.

Thanks!  That would be great Smile

rahul's picture

Oops, this just skipped my mind. Please find the Shared Profile provider attached (I haven't used it for a while, hence might need some tweaking but should work mostly).

Cheers!  Happy New Year!

rahul's picture

Thanks Chris, Happy New Year to you too!!!

i have facing the problem in dnn,

i have not login in portal 0 but i can login in my others portals site

same username and password ?

??????????????

rahul's picture

Hi Imran, your question is not clear and I am assuming you are not able to login to second portal with the same username/password with which you can login to first. If the same is true, you will need to register on the second portal with exactly same username/password and then you should be able to use it on the second.

Once registered, if you change password on one portal, it would automatically reflect on the other portal too.

Can I have the user accounts appear globally with two parent portals? Example...I have two parent portals, however the portal 0 has all the users that registered but they are not in the second parent portal.

rahul's picture

Hi Mark, multiple ways to do it:

  1. Create a Trigger on UserPortals table that inserts/deletes the same row for second portal as rows are inserted/deleted for the first one.
    Once you create the trigger, run a INSERT INTO/SELECT FROM sql statement once to sync users between 2 portals manually.
  2. Write a simple custom module to fetch data from Users/UserPortals tables manually.
  3. Use a third-party module available on DNN store or source forge.