How to use IFastFileDownload in EPiServer CMS 5?

Vote:
 
Hi. In EPiServer CMS 4.61 i used the IFastFileDownload for some purposes. When I try to do the same in EPiServer CMS 5.1 I get an InvalidCastException. Unable to cast object of type 'EPiServer.Web.Hosting.VirtualPathVersioningProvider' to type 'EPiServer.Web.Hosting.Versioning.IFastFileDownload'. Is it not possible do this in EPiServer CMS 5.1? If it is possible, how do I do it? EPiServer CMS 4.61: string path = "/demo/myfolder/mytext.txt"; UnifiedFile file = UnifiedFileSystem.GetFile(path); IFastFileDownload filedownload = (IFastFileDownload)file.Provider; EPiServer CMS 5.1: string path = "/demo/myfolder/mytext.txt"; UnifiedFile file = HostingEnvironment.VirtualPathProvider.GetFile(path) as UnifiedFile; IFastFileDownload picdownload = (IFastFileDownload) file.Provider;
#15956
Mar 25, 2008 19:07
Vote:
 
string localPath = file.LocalPath; ..will get you the same value so there is no reason to use IFastFileDownload anymore. Be aware that a unified file implementation that does not provive a local path may return a Null value here (the same way a provider was not required to return a IFastFileDownload).
#16692
Mar 25, 2008 19:14
Vote:
 
Hi Per. I will try that out. Thank you for your help! BR, Tore
#16693
Mar 25, 2008 19:14
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* 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.