Vulnerability in EPiServer.Forms
I have a situation where I would like to refer to the physical path of the VPP directory (ex. c:/sites/site1/vpp). I could of course hard code the directory but I really would like to generate this directory path dynamically from code behind. I've look around but I haven't found a way to reference this physical path. I'm not really interested in c:/sites/site1/vpp/global files or c:/sites/site1/vpp/pagefiles but the root of the whole vpp. Anyone know of this is possible?
First, there is no common root for virtual path providers. That is it is no requirement that all must reside in same directory (even if that is the typical scenario) for example you could have one mapped to a local drive as "c:\vpps\global" while another is on a file share like "\\fileshare\vpps\shared".
What you can do is get all vpps in the system by accessing VirtualPathHandler.Instance.VirtualPathProviders (this give you a dictionary where the provider is the key). Note that this contain all registered virtual path providers, some of them might not be backed by a filesystem (e.g. there are database backed providers).
So in your case I guess you are interested of instances of VirtualPathVersioningProvider (and potentially VirtualPathNativeProvider). So then you should get all providers of those types (and cast them). Then you can access the physical root as property "PhysicalBasePath" (for versioning provider) or "LocalPath" (for native provider).
Okey, thank you Johan. I decided to solve my issue by adding the root path to a variable in web.config.