我是asp.net的新手。我在树视图中有一个链接,用于在d驱动器内的文件夹上打开位于Web服务器中的文件。当我从Visual Studio中执行此操作时,它是工作文件,但是当我发布它时链接不起作用。
foreach (FileInfo file in directory.GetFiles())
{
//Add each file as Child Node.
TreeNode fileNode = new TreeNode
{
Text = file.Name,
Value = file.FullName,
Target = "_blank",
//NavigateUrl = @"C:/Temp/Car Loan/AUB.pdf"
// NavigateUrl = (new Uri(Server.MapPath("~/"))).MakeRelativeUri(new Uri(file.FullName)).ToString()
NavigateUrl = (new Uri(Server.MapPath("~/"))).MakeRelativeUri(new Uri(file.FullName)).ToString()
};
directoryNode.ChildNodes.Add(fileNode);
}
PopulateTreeView(directory, directoryNode);