SharePoint 2010 – Central Admin tooling to create host header site collections

Just like SharePoint 2007, you can create host-header based site collections in SharePoint 2010 as well. It means, that you do not necessarily need to create a site-collection under a managed path like /sites/, you can create multiple root-level site collections on same web-application/port by using host-header site collections. All you need to do is point your domain or sub-domain to your web-application and create a matching site-collection that you want.

But, just like in 2007, it is something that you do by using STSADM, and is not available on Central Admin UI in 2010 as well. Yeah, though you can now also use PowerShell to create one:

C:\PS>$w = Get-SPWebApplication http://sitename
 
C:\PS>New-SPSite http://www.contoso.com -OwnerAlias "DOMAIN\jdoe" -HostHeaderWebApplication $w -Title "Contoso" -Template "STS#0"
 
This example creates a host header site collection. Because the template is provided, the root Web of this site collection will be created.

I’ve been playing with WCM in SharePoint 2010 more and more, and for that I preferred creating hosts file entries for desired domains and create site-collections by those headers – in my dev environment. I used PowerShell initially, but then got interested to build my own UI on Central Admin instead.

Developed with Visual Studio 2010

So I used new Visual Studio 2010 tooling to create an empty SharePoint 2010 project. Added an application page (there is no option to add _Admin page item in VS 2010 RC), that got created in Layouts “mapped” folder. Created a new Admin mapped folder for 14-“hive”, and moved my new page there instead. Yes, I didn’t change the base class for page, its just that it runs under _admin, but it is indeed a LayoutsPageBase inherited page.

image

To introduce a action-link in Central Admin console, I created following element:

   1:  <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
   2:    <CustomAction
   3:          Id="CreateSiteByHeader"
   4:          Location="Microsoft.SharePoint.Administration.Applications"
   5:          Title="Create site collections by host header"
   6:          GroupId="SiteCollections"
   7:          Sequence="15"
   8:          RequiredAdmin="Delegated"
   9:          Description="Create a new top-level web site, by host header" >
  10:      <UrlAction Url="/_admin/OfficeToolbox/CreateSiteByHeader.aspx"  />
  11:    </CustomAction>
  12:  </Elements>

Used Reflector to understand any special code behind createpage.aspx, and created a new for our purpose – CreateSiteByHeader.aspx. From there I quickly created a similar code behind, without all the fancy of Farm Config Wizard handling and dealt with alternate implementations of sealed classes! Goal was to create a professional looking and OOB-type experience. I also added Regex validation to ensure user types a valid domain name as header value. Below is the result…

image 

Release @ Codeplex

I’ve released to WSP on OfficeToolbox @ Codeplex, and you can download from here.

Update - Latest release is now uploaded and works with RTM.

Hope you find it useful…

-- Sharad

Published Sunday, March 28, 2010 3:44 AM by eJugnoo

Comments

# Twitter Trackbacks for SharePoint 2010 ??? Central Admin tooling to create host header site collections - Sharad Kumar [asp.net] on Topsy.com

Pingback from  Twitter Trackbacks for                 SharePoint 2010 ??? Central Admin tooling to create host header site collections - Sharad Kumar         [asp.net]        on Topsy.com

# re: SharePoint 2010 – Central Admin tooling to create host header site collections

Tuesday, May 11, 2010 6:13 AM by Matti Paukkonen

This tool would be just what I'm looking for. But it's not working with the Sharepoint 2010 RTM installation. Have you tested it with RTM? There was something meationed at Codeplex that RC works..

# re: SharePoint 2010 – Central Admin tooling to create host header site collections

Tuesday, May 11, 2010 6:39 AM by Sharad Kumar

@Matti

Release has been updated on codeplex for RTM. Please download and retry.

Thanks for your feedback

--Sharad

# re: SharePoint 2010 – Central Admin tooling to create host header site collections

Tuesday, August 09, 2011 2:14 PM by Cam

This tool would be exactly what I was looking for except that it requires that a WebTemplate be selected.

# re: SharePoint 2010 – Central Admin tooling to create host header site collections

Sunday, October 16, 2011 12:52 PM by james

I have installed and created a site collection with Primary administrator. When I browser the site I couldn't able to login.

# Subdomains for site collections &laquo; Sharepoint. Sharing the knowledge

Pingback from  Subdomains for site collections &laquo; Sharepoint. Sharing the knowledge

Leave a Comment

(required) 
(required) 
(optional)
(required)