当c#中的treeview数据随文件系统一起提供时,它会显示服务器系统文件还是本地系统文件?
我在asp.net网页中创建了一个treeview,并将文件系统作为treeview的节点传递。我想知道,如果提供treeview来显示文件结构,它会显示我的本地系统文件结构还是服务器计算机文件结构 代码隐藏:当c#中的treeview数据随文件系统一起提供时,它会显示服务器系统文件还是本地系统文件?,c#,asp.net,c#-4.0,treeview,treenode,C#,Asp.net,C# 4.0,Treeview,Treenode,我在asp.net网页中创建了一个treeview,并将文件系统作为treeview的节点传递。我想知道,如果提供treeview来显示文件结构,它会显示我的本地系统文件结构还是服务器计算机文件结构 代码隐藏: Array drivesList = DriveInfo.GetDrives(); for (int index = 0; index < drivesList.GetLength(0); index++) { string text = d
Array drivesList = DriveInfo.GetDrives();
for (int index = 0; index < drivesList.GetLength(0); index++)
{
string text = drivesList.GetValue(index).ToString();
TreeNode parentNode = new TreeNode(text);
parentNode.PopulateOnDemand = true;
TreeView1.Nodes.Add(parentNode);
}
Array drivesList=DriveInfo.GetDrives();
for(int index=0;index
您的ASP.Net代码在服务器端执行。
因此,如果使用以下代码填充树视图:
Array drivesList= DriveInfo.GetDrives();
for (int index = 0; index < drivesList.GetLength(0); index++)
{
string text = drivesList.GetValue(index).ToString();
TreeNode parentNode = new TreeNode(text);
parentNode.PopulateOnDemand = true;
TreeView1.Nodes.Add(parentNode);
}
Array drivesList=DriveInfo.GetDrives();
for(int index=0;index
您将看到服务器的逻辑驱动器
(对于正在运行web服务器进程的用户帐户IIS/可见的驱动器)
函数DriveInfo.GetDrives()
返回代码所在计算机的逻辑驱动器
正在(在您的情况下是服务器计算机)上运行。阵列驱动器列表=DriveInfo.GetDrives();对于(int index=0;index