SharePoint - Direct Dependencies Limit with Master page User Controls

Introduction

The westernaustralia.com web site uses a large number of user controls hard coded across twenty-odd page layouts--a big no-no. While we've matured as a dev. team since this site launched and now fully appreciate the value of web parts and a small set of key page layouts, unfortunately the site is live as-is.

From a production support perspective we're still working on the site and adding new user controls here and there. This shouldn't be problematic but MOSS, in its infinite wisdom, limits the number of user controls on a page and fails when that limit is reached.

Server Error in Application

When developing large portals, it can often be a mistake. associated with exceeding limit inclusion in external objects, such as pages, .ascx files.

This problem can easily be corrected by editing the Web.config file. For this limit corresponds to the parameter DirectFileDependencies.

If you insert more than 10 user controls in a masterpage, you might get an error similar to this:

The page ‘/path/somefile.master’ allows a limit of 11 direct dependencies, and that limit has been exceeded.

You can easily increase that limit as it is actually set in your sharepoint web.config:

Steps edit web.config

  1. Browse to C:\inetpub\wwwroot\wss\VirtualDirectories\

    Browse Folder
     
  2. Open the folder corresponding to your Sharepoint website.
     
  3. Edit the file web.config
     
  4. Do a search for “safemode“.
     
  5. Change the property DirectFileDependencies from 10 to a value your choice.
     
  6. Do an iisreset command and you’re done!

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

The solution is to simply increase the value to the desired value.