Creating Dynamic page using code behind
i am try to create dynamic page using below code. and if i try to create i got an error
"Telerik.Sitefinity.Pages.Model.PageNode,
Telerik.Sitefinity.Model was not granted View in Pages
for principals with IDs 00000000-0000-0000-0000-000000000000"
please give some solution.
Thanks
Jmr Rafiq.
Code
try
var newPageNode = App.WorkWith().Page()
.CreateNewStandardPage(parentGuid,new Guid())
.Do(p =>
p.Name = name;
p.Title = title;
p.UrlName = urlName;
p.ShowInNavigation = false;
p.LastModified = DateTime.UtcNow;
p.DateCreated = DateTime.UtcNow;
p.Page.Title = title;
p.Page.HtmlTitle = title;
p.Description = name;
)
.CheckOut()
.SetTemplateTo(templateGuid)
.Publish()
.SaveChanges();
SiteMapBase.Cache.Flush();
catch
throw;
Hi Jmr,
The user you use when you create a page does not have permissions for view and respectively create. You need to grant the user with these permissions from the UI or you can use Provider.SuppressSecurityChecks of the PageManager
Greetings,
Ivan Dimitrov
the Telerik team
thanks!
if i don't want to check permission should i give below code?
using (var PageCreation = App.WorkWith())
PageCreation.Pages().GetManager().Provider.SuppressSecurityChecks = true;
thnks
Jmr
Hi Jmr,
When you suppress the security check you should be able to create your page.
All the best,
Ivan Dimitrov
the Telerik team
its working!
thanks.
jmr