I have a routine that uses the Fluent API to create a collection of pages for a sample application. All of the pages use the same template (which is created using a Store.Master page file). This routine has worked fine up until I updated to Sitefinity 4.0 SP1.
The routine closely follows the sample provided here:
The actual code for my routine appears at the bottom of my post.
The symptoms of the problem I am having are these:
1. Using the Sitefinity Page Editor, I create a page named "Home" using my "Store" template. I can Preview the page and I can "View" the page and everything looks fine. I can add a widget to the page, and everything is still fine.
2. Using my API routine, I create an empty page called "Test" using my "Store" template. I can show the page using Preview button in design mode and it looks fine. If I publish the page then click the "View" button for my Test page, the response is a totally blank page. It has tags <html> <head> and an empty <body> element. The <head> has a single <meta> element and that is all.
I have double checked all the permission settings I can find - permission is granted for "Everyone" to view all.
The full source code of the method I am using is shown below. It works in build 1098 but not 1210. I am calling this method to create my "Test" page using the following code:
PageManager manager = PageManager.GetManager();
CreateStorePage(manager, null, 0, "Test", "Test", "test", "Store", false);
There is a cautionary note in the html "sitefinity-essentials-pages-creating-pages.html
" article cited above which reads as follows.
Note that in this example we are using PageManager() so we can take a valid template ID and then pass this ID to SetTemplateTo() method.
This will be changed in the official release, with the introduction of Template facade, so the PageManager will not be used.
Do I need to change the way I locate my Store template and associate it to my page?
Is there anything extra I need to do with Page permissions?
Is there an updated version of the article sitefinity-essentials-pages-creating-pages.html
now that the official release is out?
=============== Source code - CreatePage() Method ==========================
public PageNode CreateStorePage(PageManager manager, PageNode parentNode, int ordinal, string pageName, string menuTitle, string url, string templateTitle, bool showInNavigation)
PageTemplate storeTemplate = GetPageTemplateByTitle(manager, templateTitle);
global::Telerik.Sitefinity.Fluent.Pages.PageFacade pf = App.WorkWith().Page();
PageNode newPageNode = pf.CreateNewStandardPage(PageLocation.Frontend)
// parent must be constructed using same PageManager instance as the PageFacade is using.
PageNode parent = parentNode != null ? pf.PageManager.GetPageNode(parentNode.Id) : null;
p.Name = pageName;
p.Title = menuTitle;
//unique url of the page
//this property is required
p.UrlName = url;
p.ShowInNavigation = showInNavigation;
p.LastModified = DateTime.UtcNow;
p.DateCreated = DateTime.UtcNow;
//set menu name
p.Page.Title = menuTitle;
//set title which appears in page header
p.Page.HtmlTitle = menuTitle;
// All store pages require view state
p.Page.EnableViewState = true;
p.Description = menuTitle;
p.Ordinal = ordinal;
p.Attributes["ModuleName"] = Iciniti.Telerik.IcinitiStoreModule.ModuleName;
if (parent != null)
p.Parent = parent;