Skip to content
Albert-Jan Schot
Albert-Jan Schot

· 2 min read

Post

Confusing access denied on the defaultpage of a PublishingWeb

Working on a new breadcrumb solution for SharePoint 2010 I encountered a nice error, and as it turned out sometimes you just ‘forget’ what you should already know. In this case whenever a user with read permissions hit a page my breadcrumb would throw an access denied error (it was of course nicely logged to the ULS), while everyone who had contribute rights didn’t have any troubles seeing the breadcrumb.

The error itself was pretty self-explanatory: `

Access Denied. Exception: System.UnauthorizedAccessException: Access denied. at Microsoft.SharePoint.Library.SPRequestInternalClass.GetFileAndFolderProperties(String bstrUrl, String bstrStartUrl, ListDocsFlags ListDocsFlags, Boolean bThrowException, Int32& phrStatus, Object& pvarFiles, Object& pvarDirs, UInt32& pdwNumberOfFiles, UInt32& pdwNumberOfDirs) at Microsoft.SharePoint.Library.SPRequest.GetFileAndFolderProperties(String bstrUrl, String bstrStartUrl, ListDocsFlags ListDocsFlags, Boolean bThrowException, Int32& phrStatus, Object& pvarFiles, Object& pvarDirs, UInt32& pdwNumberOfFiles, UInt32& pdwNumberOfDirs).
Access Denied for /web1/Pages/default.aspx. StackTrace:
at Microsoft.SharePoint.Utilities.SPUtility.HandleAccessDenied(HttpContext context)
at Microsoft.SharePoint.Utilities.SPUtility.HandleAccessDenied(Exception ex)
at Microsoft.SharePoint.Library.SPRequest.GetFileAndFolderProperties(String bstrUrl, String bstrStartUrl, ListDocsFlags ListDocsFlags, Boolean bThrowException, Int32& phrStatus, Object& pvarFiles, Object& pvarDirs, UInt32& pdwNumberOfFiles, UInt32& pdwNumberOfDirs)
at Microsoft.SharePoint.SPWeb.GetFileOrFolderProperties(String strUrl, ListDocsFlags listDocsFlags, Boolean throwException, SPBasePermissions& permMask)
at Microsoft.SharePoint.SPFolder.PropertiesCore(Boolean throwException)
at Microsoft.SharePoint.SPFolder.get_WelcomePage()
at Microsoft.SharePoint.Publishing.PublishingWeb.get_DefaultPage()
at DemoCode.GetSomeProperties(SPWeb web)

Now obviously I was missing some rights, and if you would have worked with the PublishingWeb.DefaultPage you probably know some of the blogs out there about the limitations that an anonymous user will not be able to use it (if not you should read Inconvenient good page title with SharePoint Server Web Content Management (revisited) by Waldek. The strange thing was that my users did have read permissions, however after debugging a while the GetFileOrFolderProperties in the stacktrace triggered me to dig into it a bit. As it turned out to do an:

As it turned out to do an:

PublishingWeb.GetPublishingWeb(SPContext.Current.Web).DefaultPage

You will need to have ‘browse directories’ permission and it turned out that someone changed the default readers group to exclude that specific leve

Albert-Jan Schot

Albert-Jan Schot

CTO, Microsoft MVP & FastTrack Recognized Solution Architect

I am Albert-Jan Schot, CTO at Blis Digital, Microsoft MVP, and FastTrack Recognized Solution Architect focused on Microsoft 365, Azure, and AI agents. I help teams turn complex Microsoft Cloud challenges into practical architecture decisions and shipped outcomes.

Copilot Studio Microsoft 365 Agent Flows

Zuid Holland, Netherlands

Related Posts