London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
Hi all,
I have exported a subsection of a site into my local episerver installation. The pages in this subsection have references to files inside file manager(UrlToDocument properties).
I have the following code to read and display the files:
-------------------------------------------------------------
protected string GetExcelReportSize()
{
if (CurrentPage["LinkToExcelReport"] != null)
{
FileInfo file = newFileInfo(GetFilePath("LinkToExcelReport"));
return file.Length.ToString();
}
return"";
}
protected string GetFilePath(string filename)
{
if (CurrentPage[filename] != null)
{
var vfile = System.Web.Hosting.HostingEnvironment.VirtualPathProvider.GetFile(CurrentPage[filename].ToString().Replace("%20", " ")) as UnifiedFile;
if (vfile != null)
{
return vfile.LocalPath;
}
return"";
}
return"";
}
-------------------------------------------------------------
Link To Excel Report (Live): /PageFiles/757/York%20Retail%20Market%20Q4%202010%20DATA.xlsx
Link To Excel Report (Local): ~/link/d3c50d041bb3403995c171bf92808453.xlsx
I get an "[ArgumentException: The path is not of a legal form]" error.
As you can see the live version works fine, but the imported version in my local site doesn't. The VPP directory contains the file that is required but the link is not resolving.
Any help would be greatly appreciated.
Thank You