Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

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
Jan 09, 2008 9:39
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
Jan 09, 2008 10:29
Vote:
 
Hi Per. I will try that out. Thank you for your help! BR, Tore
#16693
Jan 09, 2008 11:18
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.