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

Forums / Developing with Sitefinity / How do share content across sites?

How do share content across sites?

5 posts, 0 answered
  1. Elizabeth
    Elizabeth avatar
    83 posts
    Registered:
    23 Mar 2005
    04 Jun 2009
    Link to this post
    I've gone through the steps in the user manual for "Adding Providers" and I now see the two different news sources on one of the sites, but now how do I share this across sites? The manual says to change the connectionStringName attribute but doesn't give any more details, can you provide more information about that?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    04 Jun 2009
    Link to this post
    Hi Elizabeth Munsey,

    It depends whether your websites share one database or different.

    1. One database - the providers should have the same applicationName
    2. Different databases - you should add a new connection string that points to the second website database. you can do this in your web.config file <connectionStrings> node.
    Afterwards add new data access connection.

     <dataAccess defaultConnection="DefaultConnection">  
          <connections> 
            <add name="MyConnection" driver="Telerik.Cms.Engine.Data.Providers.GCSql2005Provider, Telerik.Cms.Engine.Data" 
              connectionStringName="MyConnectionStringName" /> 
          </connections> 
        </dataAccess> 

    Then create a new provider and set connectionStringName property of the provider to the newly added connection string.

    <add name="MyProvider" urlRewriteFormat="[Publication_Date]/[Name].aspx" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_" visible="True" defaultMetaField="Name" securityProviderName="" allowLocalization="False" allowVersioning="True" allowWorkflow="False" allowComments="false" commentsModeration="true" versioningProviderName="" connectionStringName="MyConnection" type="Telerik.Cms.Engine.Data.Providers.DefaultProvider, Telerik.Cms.Engine.Data"/> 

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  3. Elizabeth
    Elizabeth avatar
    83 posts
    Registered:
    23 Mar 2005
    05 Jun 2009
    Link to this post
    The shared content would be in a separate database.

    I tried to incorporate your instructions with what is in the user manual and now I'm getting the error:

    The given key was not present in the dictionary
  4. Elizabeth
    Elizabeth avatar
    83 posts
    Registered:
    23 Mar 2005
    05 Jun 2009
    Link to this post
    OK, I believe I got it working now. It was confusing because I believe the instructions in the user manual are for sites sharing a database??? The instructions say to set a different applicationName but it looks for sites not using the same database that I don't use that property??

    The changes below I made in bold are the additions I made in the web.config in the project that is the source for the shared content:

    <connectionStrings>
            <add name="Shared" connectionString="data source=111.11.11.111;UID=xxxxx;PWD=xxxxx;initial catalog=TEST"
         providerName="System.Data.SqlClient" />

      </connectionStrings>

     <dataAccess defaultConnection="DefaultConnection">
          <connections>
                     <add name="SharedConnection" driver="Telerik.Cms.Engine.Data.Providers.GCSql2005Provider, Telerik.Cms.Engine.Data"
      connectionStringName="Shared" />

          </connections>
        </dataAccess>

    Under <cmsEngine defaultProvider="Generic_Content">
          <providers>
            <clear />
              <add name="Shared_News" urlRewriteFormat="[Publication_Date]/[Name].aspx" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_" visible="True" defaultMetaField="Name" securityProviderName="" allowLocalization="False" allowVersioning="True" allowWorkflow="False" allowComments="false" commentsModeration="true" versioningProviderName="" connectionStringName="SharedConnection" type="Telerik.Cms.Engine.Data.Providers.DefaultProvider, Telerik.Cms.Engine.Data"/>

    Under <metafields>:

     <add key="Shared_News.Title" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="" />
              <add key="Shared_News.Summary" valueType="LongText" visible="True" searchable="True" sortable="True" defaultValue="" />
              <add key="Shared_News.Author" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="" />
              <add key="Shared_News.Source" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="" />
              <add key="Shared_News.Publication_Date" valueType="DateTime" visible="True" searchable="True" sortable="True" defaultValue="#Now" />
              <add key="Shared_News.Expiration_Date" valueType="DateTime" visible="True" searchable="True" sortable="True" defaultValue="#Max" />
              <add key="Shared_News.Thumbnail" valueType="ShortText" visible="True" searchable="False" sortable="False" defaultValue="" />
              <add key="Shared_News.Category" valueType="ShortText" visible="True" searchable="True" sortable="True" defaultValue="">
              </add>



    <news defaultGenericProvider="News">
          <genericContentProviders>
                      <add providerName="Shared_News" publicationDateField="Publication_Date" expirationDateField="Expiration_Date" thumbnailUrlField="Thumbnail" urlRewriteFormat="[Publication_Date]/[Title].aspx" urlDateTimeFormat="yy-MM-dd" urlWhitespaceChar="_" />
          </genericContentProviders>
        </news>
            

  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    06 Jun 2009
    Link to this post
    Hello Elizabeth Munsey,

    Thank you for sharing your settings with the community.

    The UserManaual gives instruction if you are using the same database and this was the reason why I gave you the other approach - with different connection string. I believe that this post will help to the other community members as well.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
5 posts, 0 answered