The following error may be raised when accessing content items that are configured to use a layout item referring to a non-existing .ASPX file.
ERROR Application error.
Exception: System.Web.HttpException
Message: The file '/layouts/MyLayout.aspx' does not exist.
Source: System.Web
at System.Web.UI.Util.CheckVirtualFileExists(VirtualPath virtualPath)
at System.Web.Compilation.BuildManager.GetVPathBuildResultInternal(VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVPathBuildResultWithNoAssert(HttpContext context, VirtualPath virtualPath, Boolean noBuild, Boolean allowCrossApp, Boolean allowBuildInPrecompile)
at System.Web.Compilation.BuildManager.GetVirtualPathObjectFactory(VirtualPath virtualPath, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
at System.Web.Compilation.BuildManager.CreateInstanceFromVirtualPath(VirtualPath virtualPath, Type requiredBaseType, HttpContext context, Boolean allowCrossApp, Boolean noAssert)
at System.Web.UI.PageHandlerFactory.GetHandlerHelper(HttpContext context, String requestType, VirtualPath virtualPath, String physicalPath)
at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Ensure that the layout item used by the item points to a valid .ASPX file.
Perform the following steps if you would like Sitecore to redirect the user to the “Layout not found” page instead of showing an application error:
- Place the attached Sitecore.Support.389964.dll in the bin folder.
- Add the following processor to the httpRequestBegin pipeline, after the LayoutResolver processor:
<httpRequestBegin>
...
<processor type=”Sitecore.Pipelines.HttpRequest.LayoutResolver, Sitecore.Kernel”/>
<processor type="Sitecore.Support.Pipelines.HttpRequest.LayoutFileResolver, Sitecore.Support.389964"/>