When attempting to navigate to our SharePoint portal we received the infamous “File Not Found” error. (See image below)
We tested our database connection by creating an ODBC connection and it was successful. Not only were the portals down but Central Administration was as well. So we made the following changes:
Follow these steps:
1. Navigate to C:\inetpub\wwroot\wss\Virtual Directories\
<your web application’s virtual directory>
a. You can also open IIS
b. Expand Sites
c. Right click on your sharepoint site
d. Choose explore
e. Then proceed to step 2
2. Copy and paste the web.config file (making a backup)
3. Open web.config using notepad.
4. Search for “CallStack” , set this equal to true.
5. Search for “Custom”, set the customerrors = “Off”.
6. Save the web.config file and refresh your page in the browser.
After we made these changes we started receiving the message below:
I then right-clicked on the page and selected “View Source” and saw the information highlighted below:
[FileNotFoundException]: The file /_catalogs/masterpage/_controltemplates/Welcome.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 Microsoft.SharePoint.ApplicationRuntime.SPDatabaseFile.GetDirectDependencies(HttpContext context, SPRequestModuleData requestData)
After looking in that directory the file was not missing. I decided to look at it using SharePoint Designer. What I saw using Designer was the following image:
I finally found this information:
Most likely the tilde sign “~” has dissapeared in your references on the masterpage after editing it in the sharepoint designer.
In the beginning of the masterpage you have register statements that should look like this
<%@ Register TagPrefix=”wssuc” TagName=”Welcome” src=”~/_controltemplates/Welcome.ascx” %>
<%@ Register TagPrefix=”wssuc” TagName=”DesignModeConsole” src=”~/_controltemplates/DesignModeConsole.ascx” %>
After reviewing the file in Notepad I realized the ~ symbols were in fact missing but after inputting them I received another error but at least it told me it was a problem with the default.master page. I copied over the default.master from the backup the night before and it worked like a charm. Not sure what changed the page but just another reminder to always have a backup copy!! I realize this is not an exact fix but when production is down and you know what the problem is, why wait to fix it?
Ok so after diving a little deeper into this after the fact it seems there is a glitch in SharePoint Designer where when you open certain pages, including default.master, it adds/removes code. We opened the same file this morning and saved it after making minor changes and it was corrupted again but when you open the same file in Notepad and make the needed changes and save it, it works fine. I am sending this to Microsoft Support to get their opinion on it. Just a note of caution to those of you who use SP Designer to make a backup copy before opening it period.
SharePoint Designer actually breaks the master page when it opens because you are essentially un-ghosting the site. The recommended way to customize this page is to make a copy of it, and edit the copy. Then you would designate the custom master page to be the default master page for your site. The reason it breaks is because SPD changes the path of two URLs within the master page. To be specific, line 5 and 6 of the file look like this before you open it:
<%@ Register TagPrefix=”wssuc” TagName=”Welcome” src=”~/_controltemplates/Welcome.ascx” %> <%@ Register TagPrefix=”wssuc” TagName=”DesignModeConsole” src=”~/_controltemplates/DesignModeConsole.ascx” %>
After opening it, you see this:
<%@ Register TagPrefix=”wssuc” TagName=”Welcome” src=”_controltemplates/Welcome.ascx” %> <%@ Register TagPrefix=”wssuc” TagName=”DesignModeConsole” src=”_controltemplates/DesignModeConsole.ascx” %>
Notice the ~/ are missing from in front of src=”_controltemplates.
This is why when you try to look at the page in design view, you see all those errors, if you add the /~ back, the design view will no longer show all those errors and the page will render correctly.
Also, another reason it is not recommended to edit the default master page is because you run the risk of a HotFix, Cumulative Update, or Service Pack overwriting it and potentially causing loss of functionality while you are fixing it or losing all your hard work if it was not backed up since you made changes to it. Please let me know if you have any questions.
- This to me is a cop out answer for a Microsoft product they released specifically to edit SharePoint.