我使用下面的代码来允许在我的intranet asp.net web应用程序中下载文件。但一名用户破解并找到了该文件的共享文件夹路径。如何限制?
System.Web.HttpResponse response = System.Web.HttpContext.Current.Response;
response.ClearContent();
response.Clear();
response.ContentType = "text/plain";
response.AddHeader("Content-Disposition", "attachment; filename=" + fileName + ";");
response.TransmitFile(Server.MapPath("FileDownload.pdf"));
response.Flush();
response.End();
发布于 2014-02-18 15:20:17
您可以在IIS中使用目录浏览选项(IIS 7)禁用它:
或者,您可以通过更改您的web.config并添加以下选项来自己完成此操作:
<configuration>
<system.webServer>
<directoryBrowse enabled="false" />
</system.webServer>
</configuration>
https://stackoverflow.com/questions/21846561
复制相似问题