MOSS 2007: Changing landing page (default.aspx)

We need to change the landing page of site from default.aspx to one of our customized page. We used the following code:


static void Main(string[] args)


            SPSite oSiteCollection = null;

            SPWeb oWibSite = null;

            SPFolder oFolder = null;




                oSiteCollection = new SPSite(http://site URL”);

                oWibSite = oSiteCollection.OpenWeb();

                oFolder = oWibSite.RootFolder;

                oFolder.WelcomePage = “document library/page name”;



            catch (Exception e)












Source: MSDN – forgot URL L

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: