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:
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.
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