Server error in ‘/’ Application – The Resource cannot be found – Solution

In a SharePoint 2007 environment, called for fixing a issue: All SharePoint sites appeared with an error”SharePoint server error in ‘/’ Application The Resource cannot be found. “

Server Error in ‘/’ Application.
The resource cannot be found.
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.

Requested Url: /sites/marketing/default.aspx

I know this is a really common error, usually, this error occurs when some resources like Master pages, User controls, etc referenced by the SharePoint site doesn’t exist (or got deleted!). In this case, the client applied a master page via custom WSP Solution, and the code deleted the master page without changing it to the default master page.
Server error in '/' Application - The Resource cannot be found - Solution

Sites reported a “File Not Found” Error initially. After enabling stack trace and disabled custom error message in web.config file, all SharePoint sites appeared with an error”SharePoint server error in ‘/’ Application The Resource cannot be found.”
FIle Not Found Error in SharePoint
All Application pages were accessible since they use a different master page. All content pages were failing because the master page referenced by them got deleted!

Went to the view source of the page, Analyzed and found it is referencing a master page “crescent.master” that doesn’t exist!

To fix the issue: Tried setting a different master page via SharePoint designer, Error disappeared!

But we can’t open each and every site and set master page, isn’t it? Automation? PowerShell! Here is the PowerShell script to Reset master pages to “Default.master” for all sites of a site collection.

#Set-ExecutionPolicy RemoteSigned

[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null

#For SharePoint 2007
function global:Get-SPSite($url){
    return new-Object Microsoft.SharePoint.SPSite($url)
}
 
#Get the site collection
Write-Host "Enter the Site Collection URL:"
$SiteCollURL= Read-Host
$SPSite = Get-SPSite($SiteCollURL)

# Change Master Page for all webs
foreach($SPweb in $SPSite.AllWebs)
{
	$SPWeb.MasterUrl="/_catalogs/masterpage/default.master"
	$SPWeb.CustomMasterUrl = "/_catalogs/masterpage/default.master"
	$SPWeb.AlternateCssUrl = ""
	$SPWeb.Update()
}

Other Causes & Solutions:
This error may occur when you edit page layouts in SharePoint designer( SPD converts the URL path that start with: “~/site/page/file.aspx” to “site/page/file.aspx”)

Solution: Reset the master page! Just go to “https://YOUR-SITE/_Layouts/ChangeSiteMasterPage.aspx” page and change the master page to default.master.

Sometimes, IIS may the culprit. Check these settings in IIS:

  • This may happen when there is a Port conflict in IIS. Stop any other sites running on the same port. 
  • IIS configurations like Web Site’s Home Directory path change could cause this issue. Make sure the Home directory exists (Its case sensitive, by the way!)
  • Make sure there is no conflict between Virtual Directory folder and your site (They both can’t be in same name)

Salaudeen Rajack

Salaudeen Rajack - Information Technology Expert with Two-decades of hands-on experience, specializing in SharePoint, PowerShell, Microsoft 365, and related products. He has held various positions including SharePoint Architect, Administrator, Developer and consultant, has helped many organizations to implement and optimize SharePoint solutions. Known for his deep technical expertise, He's passionate about sharing the knowledge and insights to help others, through the real-world articles!

2 thoughts on “Server error in ‘/’ Application – The Resource cannot be found – Solution

  • hello dear
    i am facing an error
    once I write my URL site in Upper letter it is giving me massage that An unexpected error has occurred., howerver, when I change the URL to lower letter it is working fine,
    any suggesting

    Reply
  • Thank you!
    The error must have been added ‘invisible’ during an update.
    Something always showed on the page before. This is totally invisible.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *