Hi,
PageData newComment = DataFactory.Instance.GetDefaultPageData(blogdirpage.PageLink, PersonalBlogType, AccessLevel.NoAccess);
newComment.PageName = txtCreateBlog.Text;
DataFactory.Instance.Save(newComment, EPiServer.DataAccess.SaveAction.Publish, AccessLevel.NoAccess);
string virtualPathFromFolderId = VirtualPathUtility.Combine(pageDirectoryRootVirtualPath, VirtualPathUtility.AppendTrailingSlash(folderId.ToString()));
string pageDirectoryRootVirtualPath = VirtualPathHandler.PageDirectoryRootVirtualPath;
IPageDirectory ipageDirectory = HostingEnvironment.VirtualPathProvider.GetDirectory(pageDirectoryRootVirtualPath) as IPageDirectory;
UnifiedDirectory directory = HostingEnvironment.VirtualPathProvider.GetDirectory(virtualPathFromFolderId) as UnifiedDirectory;
if (directory == null)
{
directory = ipageDirectory.CreateSubdirectory(virtualPathFromFolderId, newComment);
}
When i tried to create a pagefolder using the above code i am getting a error message like "You are not authorized to create directory" .How can i solve this error
Thanks in Advance
SADIK R
Try use the .GetPageDirectory(true) on the PageData-object.
http://sdk.episerver.com/library/cms5/html/M_EPiServer_Core_PageData_GetPageDirectory.htm
Hi,
PageData newComment = DataFactory.Instance.GetDefaultPageData(blogdirpage.PageLink, PersonalBlogType, AccessLevel.NoAccess);
newComment.PageName = txtCreateBlog.Text;
DataFactory.Instance.Save(newComment, EPiServer.DataAccess.SaveAction.Publish, AccessLevel.NoAccess);
string virtualPathFromFolderId = VirtualPathUtility.Combine(pageDirectoryRootVirtualPath, VirtualPathUtility.AppendTrailingSlash(folderId.ToString()));
string pageDirectoryRootVirtualPath = VirtualPathHandler.PageDirectoryRootVirtualPath;
IPageDirectory ipageDirectory = HostingEnvironment.VirtualPathProvider.GetDirectory(pageDirectoryRootVirtualPath) as IPageDirectory;
UnifiedDirectory directory = HostingEnvironment.VirtualPathProvider.GetDirectory(virtualPathFromFolderId) as UnifiedDirectory;
if (directory == null)
{
directory = ipageDirectory.CreateSubdirectory(virtualPathFromFolderId, newComment);
}
When i tried to create a pagefolder using the above code i am getting a error message like "You are not authorized to create directory" .How can i solve this error
Thanks in Advance
SADIK R