SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a WebTemplate using a team site as BaseTemplate, and was wondring how I could set the default page as home page instead of the home.aspx page and this during the provisioning process of the site so through a feature?

Thanks in advance!

share|improve this question
up vote 4 down vote accepted

Okay, to set the home page for a given site in a feature receiver should be something like:

SPWeb web = properties.Feature.Parent as SPWeb;

if( web != null ) 
SPFolder rootFolder = web.RootFolder; 
rootFolder.WelcomePage = "UrlToMyPage.aspx";

Use that in FeatureActivated to set the home page in a feature.

share|improve this answer
Great! Thanks Andy – Wim Hill Apr 7 '11 at 11:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.