1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Seperate User Database

Seperate User Database

18 posts, 1 answered
  1. Chris
    Chris avatar
    10 posts
    Registered:
    07 Dec 2010
    10 Jan 2011
    Link to this post
    I need to develop two sites: examplea.com, and exampleb.com. There may be additional sites in the future as well. I would like everything on both to be completely separate, with one exception. The users should be shared across both (and eventually all) sites. I found a way to do this in 3.7, which was relatively simple. I just created the same user/role tables in a separate database, and made a few web.config changes. However, I would prefer to use 4.0. What would be the best way of sharing users across sites (domains) in 4.0? Let me know if you need any additional information. Thanks for any help!
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    10 Jan 2011
    Link to this post
    Hello Chris,

    You can create additional membership, role providers or just set the default member and role providers to point to the same database.

    Greetings,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. Chris
    Chris avatar
    10 posts
    Registered:
    07 Dec 2010
    10 Jan 2011
    Link to this post
    Thank you for your quick reply. I am a big fan of the Sitefinity forums!

    Since I don't need to change any functionality of the provider, it seems like the best way would be to just set the default member and role providers to point to the same database. How do I do that?

    I would have three databases. examplea.com would use dbA, exampleb.com would use dbB, and I want them both to use dbC for member and role providers. Where do make the changes to tell examplea.com to look at dbC for the providers, but dbA for everything else?
  4. Chris
    Chris avatar
    10 posts
    Registered:
    07 Dec 2010
    12 Jan 2011
    Link to this post
    Bump.
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    12 Jan 2011
    Link to this post
    Hello Chris,

    This database dbC should be Sitefinity's database. This means you should have installed a website in order to generate the database tables and users. The connection string of Sitefinity is stored inside

    App_Data/Sitefinity/Configuration/DataConfig.config

    The important part here is that both the websites should use the same SecurityConfig.config form the project you used to generate dbC tables. This SecurityConfig file contains validationKey and decriptionKey which are used to encode/decode users' password.

    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Chris
    Chris avatar
    10 posts
    Registered:
    07 Dec 2010
    12 Jan 2011
    Link to this post
    I created two sites using the Sitefinity Project Manager: testA and testB. Then I copied DataConfig.config and SecurityConfig.config from testA to testB. Now when I go to testB/sitefinity (or just testB for that matter) I get the following error:

    Invalid root node configured for pages. No root node with the name of "FrontendSiteMap".

    Is this the process that you had in mind?

  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    12 Jan 2011
    Link to this post
    Hi Chris,

    You could get this error if the project name has been changed. The default projectName is "/". If you change it you will get "Invalid root node configured for pages."

    You could check  App_Data\Sitefinity\Configuration\ProjectConfig.config file and projectName attribute. By default the attribute is not added to the config file, so you can try to add it manually. The project name is used as an identifier.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  8. Chris
    Chris avatar
    10 posts
    Registered:
    07 Dec 2010
    12 Jan 2011
    Link to this post
    First, thank you very much for your help so far on this issue.

    I checked the ProjectConfig files for all of the test projects I have created, and they are all created with the project name attribute set to the name I used for the Project Name when I created the project using the sitefinity project manager. I have tried changing it to "/" and removing it completely, and I receive the same error regardless. (I re-saved the web.config file in between each change to make sure the app restarted because it seems like it reads those config files on startup) Any other ideas?

    Some other thoughts...
    When I created testA and testB, I went through the sitefinity startup wizard (first time you go to testA/sitefinity) where I selected a separate database for each. Then I copied the DataConfig.config and SecurityConfig.config from testA to testB. I wasn't sure if I should go though the startup wizard for testB or not, so I tried both ways.

    The first time I did not go through the startup wizard. I just created the project, copied over the DataConfig.config and SecurityConfig.config files, and clicked browse from the sitefinity project manager. This resulted in the following error:

    Violation of PRIMARY KEY constraint 'pk_sf_page_templates'. Cannot insert duplicate key in object 'dbo.sf_page_templates'. The duplicate key value is (e2b5894c-f3f8-49e8-bca7-acdfd5352e74).
    The statement has been terminated.

    So I assumed this was the wrong way. Which is when I tried going through the startup wizard then copying the config files. This resulted in the previously mentioned error:

    Invalid root node configured for pages. No root node with the name of "FrontendSiteMap".

  9. Chris
    Chris avatar
    10 posts
    Registered:
    07 Dec 2010
    12 Jan 2011
    Link to this post

    Also, on the Primary Key issue - I removed the default templates then refreshed the page, and now it gives the following error:

    The type String cannot be constructed. You must configure the container to supply this value.

  10. Chris
    Chris avatar
    10 posts
    Registered:
    07 Dec 2010
    12 Jan 2011
    Link to this post

    Just in case it helps anyone to resolve the "The type String cannot be constructed..." error:

    At the time of the exception, the container was:
      
      Resolving Telerik.Sitefinity.Modules.Pages.PageManager,OpenAccessDataProvider
      Resolving parameter "providerName" of constructor Telerik.Sitefinity.Modules.Pages.PageManager(System.String providerName, System.String transactionName)
        Resolving System.String,(none)
  11. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    16 Jun 2017
    13 Jan 2011
    Link to this post
    Hi Chris,

    Can you open a support request and give us link from where we can download both the projects and the single database you use. It looks like there is some mess with the configurations.


    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  12. Chris
    Chris avatar
    10 posts
    Registered:
    07 Dec 2010
    13 Jan 2011
    Link to this post
    Hi Ivan,

    I will be happy to submit a support ticket. However, I really think if you follow these steps, you can reproduce this problem. (I am using 4.0.1030.0)

    1. Create SQLEXPRESS database called TestDB.
    2. Using Sitefinity Project Manager, click Create New Project.
    3. Enter TestA for the Project Name and click Next.
    4. Select Standard (trial) under Already activated licenses and click Next.
    5. Check "Open the administration of this project..." and click Finish.
    6. Proceed with normal administration startup procedure, where you select TestDB as the database.
    7. Repeat steps 2, 3, & 4 but this time enter TestB for the Project Name.
    8. DO NOT Check "Open the administration of this project..." and click Finish.
    9. Copy DataConfig.config and SecurityConfig.config from ~/App_Data/Sitefinity/Configuration/ under TestA to TestB.
    10. From the Project Manager, Select TestB and click Browse.

    Please try this and let me know if you cannot reproduce the results previously mentioned. If you cannot, then I will figure out which things I can strip out of my projects to get them under 20MB so that I can attach them with a support ticket.

    Thanks again for all of your help so far!
  13. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    17 Jan 2011
    Link to this post
    Hi Chris,

    Thanks for the steps. Using them you will definitely have problems, because when you copy the DataConfig.config  with Initialized setting set to true to a site, which is not initialized yet, you could get such kind of errors.

    Back to your initial request - you want to use one shared database for users in different web sites. Let say, that it will be the database created from the first site (SiteA). So, here are the steps (I added 10 and 12):

    1. Create SQLEXPRESS database called SiteA_DB.
    2. Using Sitefinity Project Manager, click Create New Project.
    3. Enter SiteA for the Project Name and click Next.
    4. Select Standard (trial) under Already activated licenses and click Next.
    5. Check "Open the administration of this project..." and click Finish.
    6. Proceed with normal administration startup procedure, where you select SiteA_DB as the database.
    7. Repeat steps 2, 3, & 4 but this time enter SiteB for the Project Name.
    8. DO NOT Check "Open the administration of this project..." and click Finish.
    9. Copy DataConfig.config and SecurityConfig.config from ~/App_Data/Sitefinity/Configuration/ under SiteA to SiteB.
    10. Open DataConfig: set initialized="Fase" and rename Sitefinity connectionString to Membership:
    <?xml version="1.0" encoding="utf-8"?>
    <dataConfig initialized="False" xmlns:config="urn:telerik:sitefinity:configuration" xmlns:type="urn:telerik:sitefinity:configuration:type" config:version="4.0.1098.0">
        <connectionStrings>
            <add connectionString="data source=local\SQLEXPRESS;Integrated Security=SSPI;initial catalog=SiteA_DB" providerName="System.Data.SqlClient" name="Membership" />
        </connectionStrings>
    </dataConfig>

    11. From the Project Manager, Select SiteB and click Browse.and proceed with the startup wizard.
    12. Log in and change default Role, Membership and Profile providers to use Membership connection string (add parameter connectionString = "Membership"). Alternatively, you can modify SecurityConfig.config in SiteB:
    <?xml version="1.0" encoding="utf-8"?>
    <securityConfig ...>
        ...
        <roleProviders>
            <add connectionString="Membership" name="Default" />
            <add connectionString="Membership" name="AppRoles" />
        </roleProviders>
        <profileProviders>
            <add connectionString="Membership" name="OpenAccessProfileProvider" />
        </profileProviders>
        <membershipProviders>
            <add connectionString="Membership" name="Default" />
        </membershipProviders>
    </securityConfig>

    Now, the SiteB should use the users and roles from SiteA.

    Please, let us know if you still have any problems.

    Regards,
    Vlad
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
    Answered
  14. Chris
    Chris avatar
    10 posts
    Registered:
    07 Dec 2010
    17 Jan 2011
    Link to this post
    Thanks Vlad; that's exactly what I needed! If anyone is trying to share users across multiple sites, this thread will help you.
  15. Aldo
    Aldo avatar
    1 posts
    Registered:
    15 Mar 2011
    28 Mar 2011
    Link to this post
    Hi Vlad!

    I followed the steps mentioned above and the time to try, SiteB continued to show its users and roles, and shows no users added in siteA. I show in the following images as files were eventually SecurityConfig.config and DataConfig.config of SiteB after of follow the steps (I use Sitefinity 4.0 SP1)

    I hope you can help me.

    Regards
  16. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    31 Mar 2011
    Link to this post
    Hello Chris,

    I just wend through the steps again with Sitefinity 4.0 SP1 and it is working as expected - the both sites are using the same database for users and roles (SiteA_DB).
    Maybe it is not not enough clear that in step 10 you have to change the dataConfig.config of the SiteB. Please check this out - this should work.
    If not, could you please send us dataConfig and securityConfog for both sites?

    All the best,
    Vlad
    the Telerik team
  17. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    31 Mar 2011
    Link to this post
    Hello Chris,

    I just wend through the steps again with Sitefinity 4.0 SP1 and it is working as expected - the both sites are using the same database for users and roles (SiteA_DB).
    Maybe it is not not enough clear that in step 10 you have to change the dataConfig.config of the SiteB. Please check this out - this should work.
    If not, could you please send us dataConfig and securityConfog for both sites?

    All the best,
    Vlad
    the Telerik team
  18. Jason
    Jason avatar
    1 posts
    Registered:
    18 Jan 2011
    17 Aug 2011
    Link to this post
    Hello,

    I have same situation as Aldo post above, The steps are only configured for sharing Role and Membership between two sites, but it still requires to install its own database for each site (on step 11). Let's say I have more than 15 sites, I don't want to install 15 databases for each site. This solution is very easy to configure in 3.7 separate by applicationName, i don't know why it is so complicated to configure in 4.x (4.2). Basically, I only want to have one master database for Sitefinity with a lot of subsites using same database but have different sitemap, content,....Please help.

    Thanks,

    Jason
18 posts, 1 answered