My site was giving this error on certain pages when I went into Edit mode then clicked Page and then Page Settings:
Value does not fall within the expected range. at Microsoft.SharePoint.Library.SPRequestInternalClass.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)
at Microsoft.SharePoint.Library.SPRequest.GetMetadataForUrl(String bstrUrl, Int32 METADATAFLAGS, Guid& pgListId, Int32& plItemId, Int32& plType, Object& pvarFileOrFolder)
at Microsoft.SharePoint.SPWeb.GetMetadataForUrl(String relUrl, Int32 mondoProcHint, Guid& listId, Int32& itemId, Int32& typeOfObject, Object& fileOrFolder)
at Microsoft.SharePoint.SPWeb.GetFileOrFolderObject(String strUrl)
at Microsoft.SharePoint.Publishing.CommonUtilities.GetFileFromUrl(String url, SPWeb web)
at Microsoft.SharePoint.Publishing.PublishingPage.get_Layout()
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.PageSettingsPage.GetAvailableLayouts()
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.PageSettingsPage.LoadLayoutValues()
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.LoadValues()
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.PageSettingsPage.LoadValues()
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.BasePageSettingsPage.OnLoad(EventArgs e)
at Microsoft.SharePoint.Publishing.Internal.CodeBehind.PageSettingsPage.OnLoad(EventArgs e)
at System.Web.UI.Control.LoadRecursive()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
The solution was found here: http://stsadm.blogspot.com/2007/08/fix-publishing-pages-page-layout-url….
Download the STSADM extension for MOSS here: http://stsadm.blogspot.com/2007/08/fix-publishing-pages-page-layout-url….
Install it with this code: stsadm -o deploysolution -local -allowgacdeployment -name Lapointe.SharePoint.STSADM.Commands.wsp
To run the command on the whole site:
stsadm –o gl-fixpublishingpagespagelayouturl –url “http://eastpak/” -scope webapplication
To run it on a page:
stsadm –o gl-fixpublishingpagespagelayouturl –url “http://eastpak/students/teststudent25/” -scope page –pagename targetedportfolio.aspx
At any time, you can add –test to the command to see what it will be changing.
NOTE: It will not work on pages that are checked out.
Thanks to Gary Lapointe for the program.