BlogEngine is a powerful blogging engine and there may be
situation in which you would like to use it for multiple websites but one
database. One straight solution is to use different table prefix and specify
the same in web.config file in appsettings. But I personally don’t like the
idea of storing data in two different tables.Given the fact that I am using
Asp.Net membership provider, I would like to leverage built in capabilities of
membership provider to run two different applications having one single
database. So here are the steps involved in running multiple sites with one
database, assuming you are using Asp.Net membership provider.
Step1: Configure BlogEngine to use MSSQL and Asp.net
Users already using MSSQL provider can move to step 2
If you can access your hosted database remotely you can
directly use the aspnet_regsql tool to install all required tables, views,
storedprocedure etc. Otherwise use aspnet_regsql tool to create the database
locally and then create a script necessary to create the tables, views and
stored procedures etc so that the same may be run on the remote hosted site. To
see step by step guide see this video
After you have successfully configured to use MSSQL provider
you will be able to see following page.
Step2: Configure BlogEngine to use ApplicationId across the
2.1 Run the MultipleInstanceScript.Sql file. Be sure to
check the application name by default it has name ‘BlogEngine’ If you have
different application name change the string. The scripts add ApplicationId
column to all the tables of BlogEngine.
2.2 Include DbMultiBlogProvider.cs in your BlogEngine.Core/Providers/
Change following settings in web.config file.
Note the extra applicationId attribute of
DbMultiBlogProvider. Just check your aspnet_applications table and put the same
applicationId value here. Well being lazy I have use ApplicationId instead of
Add following values in Appsettings values
attribute is used to identify if anonymous access is allowed or not. Comment
If you want to deploy the same application with a different
address Just create a new application through visual studio site administration
tool and change the applicationId to the newly created applicationId. The
script file and class file is attached with the post. In case you have any
difficulty in setting up website do let me know.
Hope this helps.
PS: The same article has been posted to my blog on http://noesispedia.com