UnauthorizedAccessException when trying to create new page v

Posted by Community Admin on 04-Aug-2018 03:04

UnauthorizedAccessException when trying to create new page via api

All Replies

Posted by Community Admin on 05-Dec-2014 00:00

Hi, I'm following the sitefinity development course on pluralsight and I get a UnauthorizedAccessException when I try and create a new page via the api in c#.

The code is:
Guid pageDataId = Guid.NewGuid();

App.WorkWith().Page().
CreateNewStandardPage(SiteInitializer.CurrentFrontendRootNodeId, pageDataId)
.Do(p =>

p.Title = "Pluralsight Title";
p.Name = "Pluralsight Name";
p.Description = "Pluralsight Desc";
p.UrlName = "Pluralsight UrlMame";
p.ShowInNavigation = true;
p.DateCreated = DateTime.UtcNow;
p.LastModified = DateTime.UtcNow;
p.Page.HtmlTitle = "Pluralsight Page HTML Title";
p.Page.Description = "Pluralsight Page Desc";
p.Page.Title = "Pluralsight Page Title";
).SaveChanges();

and the exception message is:
"You are not authorized to 'Create child pages of this page' ('Pages')."

The code is exactly the same as that in the course - I just think it may be from an earlier version of SiteFinity. I'm using 7.3.5320

Any help appreciated!

Tom.

 

Posted by Community Admin on 09-Dec-2014 00:00

Hi,

The problem is coming from the fact that you are not logged in the backend of you project as administrator when the code has been executed. By default unauthenticated users are not allowed to modify/edit/delete content items and est.

Regards,
Stefani Tacheva
Telerik

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed