最近在做一个项目 然后想从客户端查询服务器端的一个文件夹下的文件 用网页显示出 我应该怎么去做啊 有没有什么思路
求高手解答 感谢

解决方案 »

  1.   

    服务器端查询文件File.Exists("")
    实现文件下载
    客户端要与服务器端通讯
      

  2.   

    在页面点击按钮判断文件
    存在实现文件下载
    string fileName = "";//客户端保存的文件名
                string filePath = Server.MapPath("");//路径            FileInfo fileInfo = new FileInfo(filePath);
                Response.Clear();
                Response.ClearContent();
                Response.ClearHeaders();
                Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
                Response.AddHeader("Content-Length", fileInfo.Length.ToString());
                Response.AddHeader("Content-Transfer-Encoding", "binary");
                Response.ContentType = "application/octet-stream";
                Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
                Response.WriteFile(fileInfo.FullName);
                Response.Flush();
                Response.End();
      

  3.   

    未能找到文件“E:\项目\Manager\DManager\DWEB”。 
    他下面是不是有什么要求或者是什么格式的文件才行?
      

  4.   

    那是文件夹使用Directory.Exists判断
      

  5.   

    那是文件夹使用Directory.Exists判断