to check if a user account has access to the homepage of a site collection, I have to get the root web's homepage. In most cases it works by using

using (SPWeb web = site.RootWeb) {
    String welcomePageUrl = web.RootFolder.WelcomePage;
    if (String.IsNullOrEmpty(welcomePageUrl))
        // Either the site collection is uncomplete (e.g. created without a template by powershell and never finished the startup assistant)
        // OR the WebTemplate of this site is "PROJECTSITE"

        throw new Exception("SiteCollection is uncomplete and does not contain a subweb. Ignored!");

    SPListItem welcomePageListItem = web.GetFile(welcomePageUrl).Item;
    SPList welcomePageList = null;

    // If welcomePageListItem is null, then a ListView was set as home page!
    if (welcomePageListItem == null)
            welcomePageList = web.GetListFromWebPartPageUrl(welcomePageUrl);
        catch (Exception)

    if (welcomePageListItem == null && welcomePageList == null)
        throw new Exception("Homepage " + welcomePageUrl + " could not be converted to list item or list for permission checks!");

In general I have to get the homepage list item (e.g. SitePages/default.aspx) or the list which view is used for homepage and check, if the user has read access.

In web browser, the homepage of such a project site is /_layouts/15/start.aspx#/default.aspx, but in which list or folder is this default.aspx stored?


It looks like you might be facing the "Minimal Download Strategy" redirection, which may confuse at first encounter.

Regardless of MDS being enabled or not, you should be able to determine the welcome page url the way you already do. You may need to split and join the path together again though:

https://sp_site/_layouts/15/start.aspx#/SitePages/newpage.aspx It is equivalent to the following non–MDS-formatted URL: https://sp_site/SitePages/newpage.aspx As a developer, you might have created SharePoint components that need some updates before they can work seamlessly with MDS.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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