Try our conversational search powered by Generative AI!

Links not resolving

Vote:
 

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

#51524
Jun 13, 2011 11:35
Vote:
 

Hi,

What IIS is the server running and what are you using localy?

/Petter

#51531
Jun 13, 2011 16:49
Vote:
 

Hi Petter and thank you for getting back to me.

Local iis version is : 7.5
Live iis version is: 7.0

Thanks

#51591
Jun 16, 2011 13:45
* 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.