If you want to retrieve the url of the PublishingPage , it is better to use Page.Uri.AbsoluteUri instead of Page.Url. Because Page.Url gives you the server relative url, this can be the result you don't want. With Page.Uri.AbsoluteUri, yuo are always safe.
6b17fc55-52e0-46da-b923-ba9d6e7d32fb|2|4.5
When you create an ASPX page in Sharepoint (for example in Sharepoint Designer), you might get the error 'Code-Blocks are not allowed in this file' when you run the page. This is because SharePoint disables the ability to create server-side script by default, you have to turn it on.
You can do this by modifying the web.config; in the configuration/SharePoint/PageParserPaths configuration section:
<PageParserPaths>
<PageParserPath VirtualPath="/pages/mypage.aspx" CompilationMode="Always" AllowServerSideScript="true" />
</PageParserPaths>
After saving the web.config and a reload of your page, the error should be gone.
7b7b502f-3b66-4b48-ba8a-6d41d470b58d|2|5.0
So this looks easy, but I have search a lot to get to this answer.
If you want to get the value from a specific field in a PublishingPage item, I used the next construction:
SPWeb rootWeb = SPContext.Current.Web.Site.OpenWeb(itemPath);
PublishingWeb publishingWeb = PublishingWeb.GetPublishingWeb(rootWeb);
pages = pweb.GetPublishingPages();
foreach (PublishingPage page in pages)
{
string fieldValue = page.ListItem["xxx"] as string;
Response.Write("Field xxx has value: " + fieldValue);
}
560c468e-90f1-423c-a742-ffb8020afd66|3|3.0