【发布时间】:2010-07-23 05:40:50
【问题描述】:
我不确定这是否可行...现在我创建了各种 .RDP 文件,我的用户可以直接从服务器下载这些文件,代码如下:
System.IO.FileInfo fileInfo = new System.IO.FileInfo(filePath);
Response.Clear();
Response.AddHeader("Content-Disposition", "attachment; filename=" + fileInfo.Name);
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
Response.ContentType = "Content-Type=application/x-rdp rdp;charset=ISO-8859-1";
Response.AddHeader("Content-Length", fileInfo.Length.ToString());
Response.WriteFile(fileInfo.FullName);
Response.End();
所以用户会点击一个链接并获得一个文件链接“~/Download/RemoteServer1234.RDP”。
出于各种原因(考虑到维护和安全性),我不希望这些文件出现在我的服务器上。有没有办法制作“假文件”并给客户端一个指针来下载驻留在内存中的数据?如果是这样,那么服务器最终如何知道何时删除任何分配的内存?
【问题讨论】: