I'm using an EPi server provider:
<add virtualPath="~/WorkplaceFiles/" physicalPath="C:\Temp Files\Workplaces"
name="workplaceFiles" type="EPiServer.Web.Hosting.VirtualPathNativeProvider,EPiServer"
showInFileManager="true" virtualName="workplaceUploadDocuments" bypassAccessCheck="true" maxVersions="5" />
Here's the defination for the provider:
VirtualPathUnifiedProvider provider =
VirtualPathHandler.GetProvider(DocumentConstants.WorkplaceFiles) as VirtualPathUnifiedProvider;
And here comes my problem - if I define a string for example like this:
string path = "2999/Documents/document.txt"
path = String.Concat(provider.VirtualPathRoot, path);
FileInfo file = new FileInfo(path);
FileInfo
won't be able to find this file, because it's using the virtualPath not the physicalPath.
How can I take the physicalPath, so that I will be able to find the file with FileInfo
?
// When I'm on this line I would like my path string to be "C:\Temp Files\Workplaces\2999\Documents\document.txt"
FileInfo file = new FileInfo(path);
Reading the question again, the proper method seems to be VirtualPathUnifiedProvider.TryGetHandledAbsolutePath
With it, you'd do something like this: