C# 使用c检查客户机的任何驱动器中是否存在目录#

C# 使用c检查客户机的任何驱动器中是否存在目录#,c#,asp.net,file,file-io,filesystems,C#,Asp.net,File,File Io,Filesystems,一个用户在其计算机的C驱动器中有一个目录,另一个用户在E驱动器中有一个目录 user A:E:\SoonrWorkplace\Clients user B: E:\SoonrWorkplace\ABC\Clients 我必须通过从路径(即\SoonrWorkplace\ABC\Clients)中删除驱动器名来检查目录是否存在 这是密码 if (!string.IsNullOrEmpty(txtClientRootFolder.Text)) {

一个用户在其计算机的C驱动器中有一个目录,另一个用户在E驱动器中有一个目录

user A:E:\SoonrWorkplace\Clients
user B: E:\SoonrWorkplace\ABC\Clients
我必须通过从路径(即\SoonrWorkplace\ABC\Clients)中删除驱动器名来检查目录是否存在

这是密码

    if (!string.IsNullOrEmpty(txtClientRootFolder.Text))
            {
                string Filepath = txtClientRootFolder.Text.Trim();

                if (Directory.Exists(Filepath))
                {
                    checkClientRootFolder.Visible = true;
                    imgstatus.ImageUrl = "~/Images/tick.png";
                }
                else
                {
                    checkClientRootFolder.Visible = true;
                    imgstatus.ImageUrl = "~/Images/remove.png";
                }


            }

where Filepath="\SoonrWorkplace\ABC\Clients"
你应该退房


if(!string.IsNullOrEmpty(txtClientRootFolder.Text)){string Filepath=txtClientRootFolder.Text.Trim();if(Directory.Exists(Filepath)){checkClientRootFolder.Visible=true;imgstatus.ImageUrl=“~/Images/tick.png”}else{checkClientRootFolder.Visible=true;imgstatus.ImageUrl=“~/Images/remove.png”;}我应该说得更清楚。请编辑您的问题以包含您的代码,注释不是代码。这段代码的结果是什么?它是否检测到您的目录?如果您的文件路径正确且存在,它将返回true。在某些情况下,它将返回false,因为用户不会输入完整路径。那么,您希望如何检查目录存在而不知道其位置?您无法从网站检查客户端计算机上的文件夹。
  if(Directory.Exists("Your file path")) 
   {
     //Do something 
   }