Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
当c#中的treeview数据随文件系统一起提供时,它会显示服务器系统文件还是本地系统文件?_C#_Asp.net_C# 4.0_Treeview_Treenode - Fatal编程技术网

当c#中的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

我在asp.net网页中创建了一个treeview,并将文件系统作为treeview的节点传递。我想知道,如果提供treeview来显示文件结构,它会显示我的本地系统文件结构还是服务器计算机文件结构

代码隐藏:

    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