forge

Bad Error – Missing User Controls in a Master Page in SharePoint

I had a customer come to me with a problem that they were getting a “File Not Found.” error while trying to move a site collection backup from one system to another.  The client is supposed to deliver their customizations via solutions files.  So I turned off custom errors, turned on the call stack and got this:

Server Error in ‘/’ Application.

The resource cannot be found.

Help Your SharePoint User

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Of course, that isn’t much help.  After some fun digging with SharePoint Spy and with SharePoint Designer, I discovered that the user control which was referenced in the custom master page (MasterUrl) didn’t exist in the directory it was being referenced from.  It turns out they had delivered the user controls outside of solutions packages to the integration environment.  The master file referenced them from the root of the ControlTemplates directory.  When they were packaged up they got deployed to a subdirectory of ControlTemplates – like they’re supposed to.   The problem is on a new server the controls weren’t in the root which caused the master page not to load which wasn’t well handled by SharePoint.  (Frankly, not that it should have been but an error in one of the logs would have been nice.)

Correct the master page location for the user controls and the problem goes away.