How To get the default page from a website

This post is a follow up for my post “Get default page Url”.

When you access an SPWeb through a URL in your browser, you will be redirected to the default page like home.aspx.

Each SPWeb has a RootFolder. And this SPFolder has a property “WelcomePage”. This property stores the relative path to the default page like “wiki pages/home.aspx”.

 1: SPContext.Current.Web.RootFolder.WelcomePage