Mentioned
In
|
 |
 |
 |
 |
Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved. Terms
of Use |
Trademarks
Article ID: 953445 - Last Review: November 17, 2008 - Revision: 2.0 Error message when you edit an .aspx Web page in SharePoint Server 2007: "Value does not fall within the expected range"On This PageSYMPTOMSWhen you edit an .aspx Web page in Microsoft Office SharePoint Server 2007, you receive the following error message: Value does not fall within the expected range. CAUSECause 1This issue occurs if there is a problem with the page layout or if the page layout is corrupted. Cause 2This issue occurs if the publishing layout URL of a publishing page contains an incorrect top-level site URL. Cause 3 This issue occurs if you move a content database or if you run a content deployment job. RESOLUTIONResolution for Cause 1- Create a new Web page layout by using the information in the old Web page layout. For example, create a new page layout that is named example_layout_new.aspx by copying the old page layout that is named example_layout.aspx.
- Remove HTML content from the new page layout.
- Upload the new page layout to the Master Page Gallery. Then, publish the new page layout.
- Use the new Page Layout template to create a Web page.
- Associate the new Page Layout template with Web pages that already exist.
Resolution for Cause 2- Use Internet Explorer to log on to the Windows SharePoint Services 3.0 site.
- Click View All Site Content.
- In the View list, click Document Libraries.
- Click the document library in which the publishing page resides.
- Click Actions, and then click Open with Windows Explorer.
- In Windows Explorer view, right-click the publishing page, point to Open with, and then click Notepad.
- Note the section of the publishing layout URL for the publishing page that resembles the following:
<mso:PublishingPageLayout msdt:dt="string">http://incorrect_servername/_catalogs/masterpage/PageLayout.aspx, Article page with image on left</mso:PublishingPageLayout> - Change the incorrect_servername value for the publishing layout URL to point to the correct server.
- Save the publishing page back to the Web page list.
- Repeat steps 1 through 9 for any other Web page that has this issue.
To resolve this problem, you can also use the code that is listed in the "More Information" section to programmatically update the URL. If you use the code, you do not have to follow steps 1 through 10. Resolution for Cause 3To resolve this issue, follow these steps: - Open the affected site in SharePoint Designer 2007.
- In SharePoint Designer, point to Reports on the Site menu, point to Problems, and then click Hyperlinks.
- In the Reports view, find broken hyperlinks that point to the previous server, right-click the hyperlink, and then click Edit Hyperlink.
- Replace the hyperlink with the correct relative path that does not refer to the previous server. For example, change "http://previous_server/_catalogs/masterpage/layout.aspx" to "/_catalogs/masterpage/layout.aspx."
- Click Change in all pages, and then click Replace.
Important Steps 1 through 5 are site specific. These steps must be performed on any other sites or subwebs that are also affected. However, these steps will replace all files in the problem hyperlink.
To resolve this problem, you can also use the code that is listed in the "More Information" section to programmatically update the URL. If you use the code, you do not have to follow steps 1 through 5. MORE INFORMATIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure. However, they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. ///
/// This source code is freeware and is provided on an "as is" basis without warranties of any kind,
/// whether express or implied, including without limitation warranties that the code is free of defect,
/// fit for a particular purpose or non-infringing. The entire risk as to the quality and performance of
/// the code is with the user.
///
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Publishing;
namespace sample_name.SupportTools
{
class FixPageLayout
{
const string USAGE = "Usage: FixPageLayout.exe <url-to-sitecollection>";
const string MASTER_PAGE_LIB = "_catalogs/masterpage";
static void Main(string[] args)
{
if (args.Length < 1)
{
Console.WriteLine(USAGE);
return;
}
string SiteCollectionUrl = args[0];
if (!Uri.IsWellFormedUriString(SiteCollectionUrl, UriKind.Absolute))
{
Console.WriteLine(USAGE);
return;
}
try
{
// obtain the site collection
using (SPSite site = new SPSite(SiteCollectionUrl))
{
// get the servername from RootWeb as it should be
using (SPWeb RootWeb = site.RootWeb)
{
SiteCollectionUrl = RootWeb.Url.ToLower();
if (!SiteCollectionUrl.EndsWith(""))
SiteCollectionUrl += "http://support.microsoft.com";
}
// check each site in the site collection
foreach (SPWeb web in site.AllWebs)
{
try
{
// check if the site is a publishing site
if (PublishingWeb.IsPublishingWeb(web))
{
PublishingWeb pubWeb = PublishingWeb.GetPublishingWeb(web);
// check each Publishing page in the current publishing site
foreach (PublishingPage page in pubWeb.GetPublishingPages())
{
// retrieve the page layout of the publishing page
string pageLayout = page.ListItem.Properties["PublishingPageLayout"] as string;
// check for correct syntax of the page layout URL
if (pageLayout != null)
pageLayout = pageLayout.ToLower();
if (String.IsNullOrEmpty(pageLayout))
{
Console.WriteLine("Error: Page \"{0}\" does not have a Page Layout assigned.\n", page.Uri);
}
else if (!pageLayout.Contains(MASTER_PAGE_LIB))
{
Console.WriteLine("Error: The Page Layout {0} for Page \"{1}\" does not point to the masterpage document library.\n",
pageLayout, page.Uri);
}
else if (!pageLayout.StartsWith(SiteCollectionUrl) && pageLayout.StartsWith("http"))
{
// here we have a page which has a page layout that has a different URL which we have to fix
Console.WriteLine("Page {0} has incorrect PageLayout Url", page.Uri);
Console.WriteLine("Old URL: {0}", pageLayout);
string pageLayoutWithoutPrefix = pageLayout.Substring(pageLayout.IndexOf(MASTER_PAGE_LIB));
string newPageLayout = SiteCollectionUrl + pageLayoutWithoutPrefix;
// perform the update in a try/catch block to cover problems
try
{
int version = page.ListItem.File.MinorVersion;
page.CheckOut();
page.ListItem.Properties["PublishingPageLayout"] = newPageLayout;
page.ListItem.File.Properties["PublishingPageLayout"] = newPageLayout;
page.ListItem.Update();
page.CheckIn("PublishingPageLayout corrected");
//major version means that the item was published. Let's publish it again.
if (version == 0)
page.ListItem.File.Publish("PublishingPageLayout corrected");
Console.WriteLine("Fixed URL: {0}\n", newPageLayout);
}
catch (Exception e)
{
Console.WriteLine("An error occurred while trying to fix the URL to the page layout:\n{0}", e);
}
}
}
}//if Publishing web
}
finally
{
// don't forget to dispose the SPWeb object
web.Dispose();
}
}
}//using SPSite
}
catch (System.IO.FileNotFoundException ex)
{
Console.WriteLine("{0}", ex.Message);
}
catch (Exception ex)
{
Console.WriteLine("An error has occured: {0}", ex.Message);
}
}
}
}
APPLIES TO- Microsoft Office SharePoint Server 2007
| kbprb kbexpertiseadvanced kbtshoot KB953445 |
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please
|
 |
 |
 |
 |
 |
 |
 |
| |