且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

禁止直接访问,但允许从页面内下载文件

更新时间:2023-12-03 08:01:34

我确定您使用的是正确的方法.

I am sure you at the correct way.

这是一个简单的例子:

Response.ContentType = "text/txt";
Response.AppendHeader("Content-Disposition", "attachment; filename=" + "file.txt");
Response.Write(file.ToString());
Response.End();

----编辑----还有其他好的示例:

---- EDIT ---- There are others good samples: