在首页以级文件夹的形式显示存在服务器硬盘上的文件信息。如C:\\部门信息管理\部门本月报表\..
该怎样在页面上 右键另存为下载到本地硬盘上呀?

解决方案 »

  1.   

    那个目录有权限给访问就可以了,asp.net 就可以读到了,然后就好办了吧
      

  2.   

    网络文件管理
    <%#Convert.ToBoolean(Eval("isDirectory")) == false && CanDownload == true ? "<A target=\"m_main\" href=\"download_File.aspx?DiskId=" + DiskId + "&filename=" + HttpUtility.UrlEncode(Eval("path").ToString()) + "\" title=\"下载文件\">  <img src=\"../../images/fileshare/down.gif\" border=\"0\" align=\"absmiddle\"></a>" : ""%>int   Id ="";
    string FileName="";
    string  dir = Server.MapPath("../path") + Id.ToString();
    Response.AppendHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(FileName.Substring(FileName.LastIndexOf('/') + 1), System.Text.Encoding.GetEncoding("utf-8")));//HttpUtility.UrlEncode
    Response.ContentType = "application/octet-stream";
    Response.WriteFile("" + dir.Trim() + FileName+"");
    Response.End();
      

  3.   

    你可以参考一下,net 中的File类和Directory类
    在System.IO命名空间下。
    很容易的,参考一下!