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;
try
{
oSiteCollection = new SPSite(“http://site URL”);
oWibSite = oSiteCollection.OpenWeb();
oFolder = oWibSite.RootFolder;
oFolder.WelcomePage = “document library/page name”;
oFolder.Update();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
Console.WriteLine(e.StackTrace);
}
finally
{
oWibSite.Dispose();
oSiteCollection.Dispose();
}
}
Source: MSDN – forgot URL L