Try our conversational search powered by Generative AI!

How do I get the physical path from a VPP, if I just have the name?

Vote:
 

How do I get the PhysicalPath attribute of a VPP?  The VPP definitions are in episerver.config like this:

<add showInFileManager="true" virtualName="Documents" virtualPath="~/Documents/" bypassAccessCheck="false" maxVersions="5" name="SiteDocuments" type="EPiServer.Web.Hosting.VirtualPathVersioningProvider,EPiServer" physicalPath="C:\Sites\VPP\EPiServerSandbox2\Documents" />

 

I have the string "SiteDocuments" (the "name" from that config element), and I want to get the "physicalPath" (assuming it exists).  I've been up and down the API and can't figure out how to do this.

#45502
Nov 09, 2010 15:41
Vote:
 

Deane, try this:

EPiServer.Web.Hosting.VirtualPathVersioningProvider p = EPiServer.Web.Hosting.VirtualPathHandler.GetProvider("SiteDocuments") as EPiServer.Web.Hosting.VirtualPathVersioningProvider;

string path = p.PhysicalBasePath.FullName;

    

#45504
Nov 09, 2010 15:58
Vote:
 

Perrfect, Johan.  Thank you.

#45505
Nov 09, 2010 16:09
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.