是否有一个的替代作为内容处置用 “附件;文件名= ...”?

我要送一个流在运行exe文件,并希望在浏览器中打开“另存为”或“运行”当我开始发送。

我使用C#HttpResponseHeader并希望使用它的成员或成员的HttpWorkerRequest

谢谢,摩西

有帮助吗?

解决方案

Content-Disposition是让浏览器提示用户保存该文件的正确方法。使用HttpResponse.AppendHeader()添加报头值,例如:

Response.AppendHeader("Content-Type", "...") 
Response.AppendHeader("Content-Disposition", "attachment; filename=...") 
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top