正在写一个.aspx网页,有一个功能是在文本框里面输入一个文件名后,网页会查找指定路径上是否存在这个文件,并将文件信息返回.
现在使用DirectoryInfo可以查找本地硬盘里面的文件,但我映射了一个网络盘(Z:),却不能访问,使用Directory.Exists("z:\123")总是返回false.
z:是可以读写的.各位有什么办法吗?我需要访问网络共享盘上的文件.private FileInfo FindLog(LogFileAttrib logfileinfo, string sppid)
    {
        
        if(!Directory.Exists(logfileinfo.strPath))
        {
            Label3.Text += WriteInfo(string.Format(@"Could not found directory:{0}", logfileinfo.strPath), "red");
            Label3.Text += "<P>";
            return null;
        }        string strname = string.Format(@"*{0}*{1}*.log",logfileinfo.station,sppid);        DirectoryInfo di = new DirectoryInfo(logfileinfo.strPath);
                
        FileInfo[] fi;
        try
        {
            fi = di.GetFiles(strname, SearchOption.AllDirectories);
           
            if (fi.Length == 0)
            {
                Label3.Text += WriteInfo(string.Format(@"Not found file:{0}",strname), "red");
                Label3.Text += "<P>";
                return null;
            }
            else
            {
                return fi[fi.Length - 1];
            }
        }
        catch (System.Exception e)
        {
            Label3.Text += WriteInfo(string.Format(@"Error:{0}",e.Message), "red");
            Label3.Text += "<P>";
            return null;
        }
        
    }

解决方案 »

  1.   

    DirectoryInfo只能访问本地硬盘~
      

  2.   

    我把网络盘的network service权限加进去了,然后用的是administrator映射的网络盘.还是不行.DirectoryInfo写WinFrom程序可以访问,写网页的不知道为什么会这样???
      

  3.   

    共享目录
    使用ftpwebrequest获取数据
      

  4.   

    我那台文件服务器只能共享文件夹,不能做FTP服务器.
      

  5.   

    在两台服务器上都新建了一个同样的账号,改了web.config后,用\\servername\sharename可以访问了,但映射出来还是不可以访问.映射的时候用的就是新建的那个用户名.