I’ve a .net 2.0 app. One of the pages contains a treeview control that displays folders on the c: drive.
The following code snippet shows how I populate the nodes of the treeview with the folders and files.
When a document link is highlighted it shows the following code:
javascript:__doPostBack(‘ctl00$ContentPlaceHolder1$TreeView1′,’sC:*|*MainFolder*|*SubFolder*|*\\C:*|*MainFolder*|*SubFolder*|*SubSubFolder/\\C:*|*MainFolder*|*SubFolder*|*SubSubFolder/AnotherFolder/\\C:*|*MainFolder*|*SubFolder*|*SubSubFolder*|*AnotherFolder*|*doc.pdf’)
On my local computer the documents open no problem, however on the server it has issues understanding this complex string of information to locate and open the file. What can I do to correct this issue?
foreach (DirectoryInfo subFolder in subFolders)
{
TreeNode child = AddNodeAndDescendents(subFolder, node);
child.Text = subFolder.Name + ” – last modified on ” + subFolder.LastWriteTime;
foreach (FileInfo file in subFolder.GetFiles())
{
int index = file.FullName.LastIndexOf(“\\”);
string strname = file.FullName.Substring(index + 1);
string[] name = strname.Split(‘.’);
TreeNode tn = new TreeNode();
tn = new TreeNode(name[0], file.FullName);
tn.Text = “last modified on ” + file.LastWriteTime + “
| ” + file.Name + ” ” + file.Length.ToString() + ” bytes |
“;
child.ChildNodes.Add(tn);
}
node.ChildNodes.Add(child);
}
treeview_slectednodechanged(….
{System.Diagnostics.Process.Start(this.TreeView.SelectedNode.Value);
}