File Dependencies Limit in Master Page

Hi,

After today’s our deployment, we are getting following error

The page ‘/_catalogs/masterpage/mymasterpage.master’ allows a limit of 11 direct dependencies, and the limit has exceeded.

Solution:

After researching for sometime it found that we have added new user control in master page and this error is related to that. There is a setting in web.config file

<SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">

“DirectFileDependencies” which is set to 10. So we increased the value of “Direct FileDependencie” attribute and site started working as follows.

<SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="20" TotalFileDependencies="50" AllowPageLevelTrace="false">

But now what is this setting,

Safe Mode element is used for security purpose basically for the customized (unghosted) SharePoint pages.

MaxControls: This attribute limits the no of controls on the page. Default value 200.

DirectFileDependencies: This attribute limits the no of user controls added in master pages. Default value 10.

TotalFileDependencies: This attribute limits the no of controls added on the page (including Master page and page layout). Default value 50.

Actually doing changes in these value is not the best practice. There are workaround to tackle this problem. But I went through several books and documents, several hours of searching on net but couldn’t find much.

Enjoy reading

Next Recommended Reading Rate Limiting In .NET 6.0