RSS

Resource Cannot Be Found or File Not Found Error in MOSS

21 May

When attempting to navigate to our SharePoint portal we received the infamous “File Not Found” error. (See image below)

 

File not found

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:

Server Error

I then right-clicked on the page and selected “View Source” and saw the information highlighted below:

</font>

    </body>
</html>
<!–
[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:

Designer Error

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

Code Snippet

<%@ 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.

Microsoft’s Response:

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.
 
23 Comments

Posted by on May 21, 2009 in SharePoint Common Issues

 

23 responses to “Resource Cannot Be Found or File Not Found Error in MOSS

  1. Bhaumik Gandhi

    August 12, 2009 at 8:20 AM

    we had the same problem and we could fix the site after applying this. But whenever any user is clicking on “My Site” link and tries to personalize, it is giving the same error. Also, when i am creating new web app from central admin, after creation and while opening the site collection it is giving me the same error.

    The reason behind all this error is same.

    How to apply this to the “Team site” definition rather applying this change to each site every time?

    Please let me know your thougts

    Thanks in advance!!!!

     
    • Laura

      August 12, 2009 at 9:13 AM

      Bhaumik,

      I’m assuming you’re asking if there is a way to “fix” all of the web.config files once instead of every time you edit one in particular. Unfortunately I don’t know a way to do this. If you created your MySite portals as a separate site in IIS it will have a separate web.config that will have to be fixed separately. Because of this issue we have just about stopped using SharePoint Designer altogether and stuck to Visual Studio. It’s strange that Microsoft would put out a product and start off charging $200 for and now all of the sudden it’s free. I’m still going to speak to one of our developers here and see if he can come up with something for you. I’ll get back to you.

       
  2. master

    August 12, 2009 at 8:38 AM

    Awesome post! You made my day.

     
  3. Amit

    August 28, 2009 at 4:21 PM

    Greate Post! Solution worked for me!

     
  4. Jenny

    February 15, 2011 at 1:57 AM

    Thanks for shareing,you saved my day

     
  5. Lidia D.

    June 19, 2012 at 6:27 AM

    I do have the ~/ in my code, yet it does not work. I am trying to open the Central Administration and I am getting “The file /_catalogs/masterpage/_controltemplates/Welcome.ascx does not exist.”
    Do you have any suggestions on what to check?
    I realize the post is old, but if you could reply, it would be greatly appreciate it.

     
    • Laura

      June 19, 2012 at 6:50 AM

      Are all of your sites down or just Central Admin? Also, what version are you running?

       
  6. Lidia D.

    June 19, 2012 at 7:45 AM

    Just the central admin. I have SharePoint 2010.
    I did realize that when I open Template\Global\default.master and Template\Layouts\default.masters with Notepad, I have the ~/ on the path, but when I opened them with SharePoint Designer, they are not there.

     
    • Lidia D.

      June 19, 2012 at 7:52 AM

      I don’t know if this helps, but I can see the Central Administration > Site Settings and the Reset to site definition (which I tried), but no other pages.

       
      • Laura

        June 19, 2012 at 8:01 AM

        Have you tried copying the web.config file for a working site over your Central Admin web.config? Make a backup copy first, of course, but it’s worth a shot. The web.config file is the culprit a LOT of times with these issues.

         
      • Laura

        June 19, 2012 at 8:17 AM

        Revert back to your backup copy and we’ll go from there. Can you copy and paste the contents of your web.config for Central Admin here so I can take a look?

         
  7. Lidia D.

    June 19, 2012 at 8:15 AM

    Do you know how I can see the All Files list in SharePoint Designer for the Central Administration? I can see it for my regular SharePoint website, and if I remember correctly, I did not have the _controltemplates folder in here, but I created it..

     
    • Laura

      June 19, 2012 at 8:26 AM

      So what changes were made before this happened? Were you changing Central Admin in SharePoint Designer?

       
  8. Lidia D.

    June 19, 2012 at 8:22 AM

    Here is the web.config file:

     
    • Laura

      June 19, 2012 at 8:24 AM

      I don’t see the config file. Can you retry? I don’t mind taking a look for you.

       
  9. Lidia D.

    June 19, 2012 at 8:22 AM

     
  10. Lidia D.

    June 19, 2012 at 8:25 AM

     
    • Laura

      June 19, 2012 at 8:42 AM

      Have you checked this location to see if the welcome.ascx file has changed?

      C: \ Program Files \ Common Files \ microsoft shared \ Web Server Extensions \ 12 \ TEMPLATE \ CONTROLTEMPLATES

      I don’t have access to our SharePoint server right now so it’s tough to troubleshoot, any idea on what changed?

       
    • Laura

      June 19, 2012 at 8:50 AM

      Also, is there a “/” in front of _controltemplates/welcome.ascx in your masterpage file?

       
    • Laura

      June 19, 2012 at 8:53 AM

      It should look like this:

       
  11. Lidia D.

    June 19, 2012 at 11:29 AM

    I fixed my problem. I had to modify the v4.master file in Templates\Global.

     
  12. michael kors belt

    January 4, 2013 at 10:10 PM

    Excellent goods from you, man. I have be mindful your stuff previous to and you’re simply too excellent. I actually like what you have received here, really like what you’re
    saying and the way during which you say it. You make it
    enjoyable and you continue to take care of to stay it wise.
    I can’t wait to read far more from you. That is really a tremendous website.

     
  13. Jolie

    July 25, 2013 at 4:59 PM

    Having read this I thought it was extremely informative. I appreciate you finding the time and energy to put this article together.
    I once again find myself spending way too much time both reading and commenting.

    But so what, it was still worth it!

     

Leave a reply to Jenny Cancel reply