Problem with Sitefinity Backend Page
Hi everyone, I have a problem while creating a sitefinity backend page using Sitefinity API, because i choose the default backend template for the page, so that way the page shows the default top menu of Sitefinity (the one with Dashboard, Pages, Content, Ecommerce, etc...). The page is created normally but when i click on "View" the page is blank, not showing the menu. The strange part is that when i create the backend page from Sitefinity Backend the top menu is showed, but using API it doesn't work. And in both ways i'm using the default backend template. Here is the code I'm using, if you see anything wrong please tell me. Thanks in advance!!!
PageManager pageManager = PageManager.GetManager();
string pageName = "BackendPage";
Guid pageID = Guid.NewGuid();
Guid pageDataID = Guid.NewGuid();
PageNode parentNode = pageManager.GetPageNodes().Where(n => n.Name == "Content").FirstOrDefault();
Guid parentPageNodeID = parentNode.Id;
App.WorkWith().Page().GetManager().Provider.SuppressSecurityChecks = true;
App.WorkWith().Page().CreateNewStandardPage(parentPageNodeID, pageID, pageDataID).Do(
p =>
p.Name = pageName;
p.Description = pageName;
p.Title = pageName;
p.UrlName = Regex.Replace(pageName.ToLower(), @"[^\w\-\!\$\'\(\)\=\@\d_]+", "-");
p.ShowInNavigation = true;
p.DateCreated = DateTime.UtcNow;
p.LastModified = DateTime.UtcNow;
p.ApprovalWorkflowState = "Published";
)
.CheckOut().Publish().SaveChanges();
var master = pageManager.EditPage(pageDataID);
if (master != null)
var control = new Control();
var pageControl = pageManager.CreateControl<PageDraftControl>(control, "Content");
pageControl.Caption = "Caption";
pageManager.SetControlDefaultPermissions(pageControl);
master.Controls.Add(pageControl);
master = pageManager.PagesLifecycle.CheckIn(master);
pageManager.PagesLifecycle.Publish(master);
master.ApprovalWorkflowState.Value = "Published";
pageManager.SaveChanges();