有一个办法就是:不要把文件下载直接对应到文件的具体地址上。
做一个download.aspx页,下载的文件名传给这个页,在这个页中,对特定文件名的文件(有可能是在硬盘地址上,有可能是在数据库中)取出来,取成fileinfo对象,然后用response.writefile(filename)往http流里写文件,或者用binarywrite也行。
然后,权限控制方面只要对download.aspx页的进入权限进行控制就行了。比如说,用session等。

解决方案 »

  1.   

    感谢yhcnux!!看到你上面的方法完全可以解决问题,但还有一问:
    如何将硬盘上的文件取成fileinfo对象???
      

  2.   

    FileInfo fi=new FileInfo(@"C:\Inetpub\wwwroot\1.zip");
    Response.Clear();
    Response.ClearHeaders();
    Response.Buffer = false;
    Response.ContentType = "application/octet-stream";
    Response.AppendHeader("Content-Disposition","attachment;filename=" +HttpUtility.UrlEncode(fi.FullName,System.Text.Encoding.UTF8));
    Response.AppendHeader("Content-Length",fi.Length.ToString());
    Response.WriteFile(fi.FullName);
    Response.Flush();
    Response.End();//要给C:\Inetpub\wwwroot\添加aspnet的读权限