If in SharePoint 2007 (WSS or MOSS) you get a file not found error on a page, the chances are you are missing a custom or 3rd Party UserControl.
A easy way to determine what control is missing is to:
1. Enable debugging – see my previous post (link);
2. View the source of the error page. In Internet Explorer, right click on the error page and select view source. In the source you will find the inner exception, which will give the path to the missing ascx UserControl file;
<!-- [FileNotFoundException]: The file /_controltemplates/Centrix/HRQuickFileSearch.ascx does not exist. at Microsoft.SharePoint.ApplicationRuntime.SPRequestModuleData.GetWebPartPageData(HttpContext context, String path, Boolean throwIfFileNotFound) at Microsoft.SharePoint.ApplicationRuntime.SPVirtualFile.CalculateFileDependencies(HttpContext context, SPRequestModuleData basicRequestData, ICollection& directDependencies, ICollection& childDependencies) at Microsoft.SharePoint.ApplicationRuntime.SPDatabaseFile.EnsureDependencies(HttpContext context, SPRequestModuleData requestData) at ….-->
The following is a must have when developing on SharePoint. Unfortunately the SharePoint Custom Error page does not provide a great deal of information as to the cause of the error. Typical SharePoint Errors area “File Not Found”, “An Error occurred please contact the system administrator”. Unfortunately for the system administrator / developer these messages are not particular helpful. Fortunately it is easy enough to get a more descriptive error message, that should hopefully see you on your way to resolving the error.
1. Open the Web.Config file for the web application that you want to debug. The default location for the Web.Config files is C:\Inetpub\wwwroot\wss\VirtualDirectories\[Web Application Name]

2. Change CallStack from false to true – XPath = “Configuration\SharePoint\SafeMode”
<SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false"> <PageParserPaths> </PageParserPaths></SafeMode>
3. Change CustomErrors Mode from On to Off – XPath = “Configuration\System.Web”
<customErrors mode="Off" />
STSDev is a useful utility for accelerating your SharePoint Application development. The tool creates your initial project structure for you, gives the assembly a strong name (for GAC deployment) and most importantly provides a number of custom build events that facilitate deploying your solution.
A nice thing about STSDev is that it gives the developer exposure to the build events that its counterparts do not (e.g. my other friend WSPBuilder). You can really see what is going on behind the scenes which really helps when you need to get down to the nitty gritty.
One issue that I come across regularly is that when I build and deploy my solution with STSDev then try to debug it, the break point is never hit. The reason for this is that the build configuration are not configured to output the debug info. The following shows you how to fix this in Visual Studio 2008:
1. Open your STSDev created project in Visual Studio 2008;
2. From the Toolbar select Project | [Project Name] Properties…;
3. Select the build tab on the Project Property Page;
4. Scroll down to the bottom of the build page and select Advanced…;
5. On the Advanced Build Settings dialog box set the Debug Info to Full;
6. Click OK and rebuild and deploy your project, you should now be ready to debug your solution.