Creating Dynamic page using code behind

Posted by Community Admin on 03-Aug-2018 13:21

Creating Dynamic page using code behind

All Replies

Posted by Community Admin on 10-Mar-2011 00:00


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; 
            

Posted by Community Admin on 10-Mar-2011 00:00

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

Posted by Community Admin on 10-Mar-2011 00:00

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

Posted by Community Admin on 10-Mar-2011 00:00

Hi Jmr,

When you suppress the security check you should be able to create your page.

All the best,
Ivan Dimitrov
the Telerik team

Posted by Community Admin on 10-Mar-2011 00:00

its working! 

thanks.
jmr

This thread is closed