How to Create Multiple site in one sitefinity website?
Hi,
I am using Sitefinity 4.4 version. I have multiple sites that I need to build and I want to use one sitefinity website and different database for each site.
Is there a way to dynamically change the DB connection on the fly?
Thanks,
Pravat Sharma.
Hi Pravat,
At the moment multiple site management is not coming as out of the box feature, and changing the database used by the project with another one may cause errors, due to the fact that we store some sensitive information in the configuration files, which are related to a particular database ( ex. project name, role id's, etc. ). However you can create a single website and replicate the database few times and customize each one of the databases ( so there are practically 4 databases serving one site ). Such scenario is not tested but you can try to switch between the databases on the fly by getting the current connection string, editing it and setting the new one as a primary connection string. For example you can get a particular connection string by its name:
var connString2 = Config.Get<
DataConfig
>().ConnectionStrings["Sitefinity"];
string strConnString = connString2.ConnectionString;