Hosting multiple communities with the ASP.NET Community Starter Kit

I had a reader of my article ping me today because he was having a hard time finding good concise help on how to set up two (or more) communities in an installation of the Community Starter Kit. Rather than just share it with one, I figured my blog is the perfect medium to share it with many. My response is below.

The kit is definitely capable of hosting multiple communities or virtual sites out of a single installation. Basically what it does is it discriminates a different “site” based on the server name used to address it. So to host multiple sites, you will need to have multiple domain names mapped to your server, or be able to discriminate them by subdomain (i.e. the servername in servername.domainname.org). Lets say you want to host ClubAAA and ClubBBB as distinct sites from a single installation. ClubAAA and ClubBBB will have to each have their own domain name or subdomain name, mapped to your server. Then when users come into http://clubaaa.org/default.aspx they see one site, and when they come in to http://clubbbb.org/default.aspx, they see another site, even though those two domain names are mapped to the same virtual directory in IIS, the directory where the CSK was installed. Or they could come in as http://clubaaa.hostingdomain.org and http://clubbbb.hostingdomain.org and those two could be mapped to the same installation folder in IIS.



Within the kit, you create two communities using the ISPAdmin interface, which will be at http://localhost/CommmunityStarterKit/ISPAdmin/default.aspx with a default installation. The key thing is to have the domain or subdomain names different. You can play around with this by adding a second community on the local machine. Have one of the communities mapped to a primary and community domain of localhost, and have the second mapped to a primary and community domain of 127.0.0.1. Because the server name part of the URL will be different when you address these two ways, the kit will see them as distinct domains and thus they can be used to discriminate different communities.



You can then go tweak the settings for one domain’s appearance to immediately see the effect. Log into the first community (http://localhost/CommunityStarterKit/default.aspx) with the admin name and password, and go to the Admin interface. Select the Edit Sections option, and select the Appearance tab at the top. Change the theme and style to a different named theme than the default Lunar one. Save the changes and return to the site. You should see a different theme. Now change the address in the URL of the browser to http://127.0.0.1/CommunityStarterKit/default.aspx and you should see the old theme.



Once you have multiple communities set up like this, any changes made to one site or the other through its admin interface will be partitioned by the settings that get saved in the database based on the server name in the URL that you are using to access the site. Likewise any changes made to the site’s data (events, downloads, discussions, etc.) will be partitioned as well from a presentation perspective. In the DB itself, the data all lives in one set of tables intermixed. But the data is always linked to the community to which it belongs so that when it is rendered out through the engine to the UI, it looks to the user like they are accessing a separate physical site.