Try our conversational search powered by Generative AI!

Get a subfolder from the PageFiles folder




When I am on Edit Mode, then click on a page and then on the File Managemenet System (on the CMS Toolbar) it offers to create a PageFile folder. I can create the folder MyNewFolder using the front end but I cannot find the folder programatically with the following code:




I know the folder exists but the name of the folder is and ID number: HostingEnvironment.VirtualPathProvider.DirectoryExists("/PageFiles/1342")

 How can I check and get the PageFile folder from a particular page?..something like:

CurrentPage.GetFileFolder()  or  something  like DirectoryHandler.getDirectory(currentpage)

Thanks in advance






Feb 14, 2011 15:19

var folder = GetPageDirectory(page,true)
var subFolder= HostingEnvironment.VirtualPathProvider.GetDirectory(folder.VirtualPath+"subFolderName/")

Feb 14, 2011 15:33

You can use the following:

EPiServer.Web.Hosting.UnifiedDirectory pageFolderForCurrentPage = CurrentPage.GetPageDirectory(true);
Feb 15, 2011 8:53
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.