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 would like to change my default welcome page on my web, but I would like to avoid activation of feature "Publishing web" on my web just for that small requirement (with that approach I'm familiar).

My custom page is deployed via module (and modul is deployed via feature) and reside in database.

Any suggestion, please?

share|improve this question
you deploy a file under _layouts with a module ? – Steve B Aug 31 '11 at 9:35
Sorry, i think they gone to database directly. My mistake. – trip Aug 31 '11 at 10:29

You can do this in code: Set the Welcome Page property of the RootFolder of a web. This property is available in 2007 and 2010

using (SPSite oSiteCollection = new SPSite("http://MyServer/sites/MySubSite")){  
  using(SPWeb oWebsite = oSiteCollection.OpenWeb()){
    SPFolder oFolder = oWebsite.RootFolder; 
    oFolder.WelcomePage = "_layouts/MyFeature/MyWelcome.aspx";

See also

share|improve this answer

If you are working with SP2010, you can activate the "Default page as wiki" feature, then, on a specific page, you can click on "set as default page".

However, you said the page resides under _layouts... this approach implies you provision your page as a wiki page.

share|improve this answer
Sorry they gone to database directly, not in _layouts. My mistake. – trip Aug 31 '11 at 10:30

You can do this with code. This was on a WSS 3.0 instance, so no publishing feature available. I have a project that placed my site pages into a document library. On the FeatureActivation method, I have the following code.

   using (SPWeb web = (SPWeb)properties.Feature.Parent)
       siteUrl = web.Url;
       web.Navigation.Home.Url = "pages/home.aspx";
share|improve this answer
Unfortunately this won't work in SP2010. I even tried to add web.allowunsafeupdates = true and web.Navigation.Home.Update(); but it didn't helped. – trip Aug 31 '11 at 10:21
Can you deploy the page to the SitePages Doc Lib? Pages in this location have a "Make Homepage" button in the ribbon for Page. – Rich Ross Aug 31 '11 at 11:23

Set the WelcomePage property of the RootFolder object of the SPWeb object (don't forget to call Update).

That will only work for relative urls which point to a page in a sharepoint list.

share|improve this answer
up vote -2 down vote accepted

After investigation, conclusion is that there isn't more elegant solution (except activate Publishing web feature, and than define via code) than - deploy page, navigate to page via browser, open page tab on ribbon, and click "Make Homepage" button. And problem solved.

share|improve this answer

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.