Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个处理文件/附件请求的 ashx 页面
最后一行代码是
System.Web.HttpContext.Current.Response.WriteFile(filename)
它最终下载了一个名为 GetFile.ashx 的文件(这听起来像一个页面名称,但如果我将 .ashx 重命名为 .zip 它实际上是正确的文件......
这可能发生的任何原因以及如何阻止它?
问题已解决,需要添加一个设置其文件名和内容类型的标头值!