UnauthorizedAccessException when trying to create new page via api
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.
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