Wednesday 4 June 2008

Direct Dependencies Limit with User Controls

The 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 it's infinite wisdom, limits the number of user controls on a page and fails when that limit is reached.

Server Error in '/' Application.
Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: The page '/_catalogs/masterpage/Home.master' allows a limit of 11 direct dependencies, and that limit has been exceeded.

Luckily, this is easy to work around via config. Each MOSS web application uses its own web.config file (a special, MOSS-extended version). In it you'll find the safeMode element which has a DirectFileDependencies attribute. This is set to 10 by default so adding more than ten user controls to a page layout will trigger the above exception. Simply increase the value to whatever you need and away you go. In my dev environment I've set it as high as 25 or 30 with no apparent issues although in production we set it where it needs to be (just over).


Spam comments will be deleted

Note: only a member of this blog may post a comment.