替代内容处置在HTTP报头(C#)
-
22-07-2019 - |
题
是否有一个的替代作为内容处置用 “附件;文件名= ...”?
我要送一个流在运行exe文件,并希望在浏览器中打开“另存为”或“运行”当我开始发送。
我使用C#HttpResponseHeader并希望使用它的成员或成员的HttpWorkerRequest
谢谢,摩西
解决方案
Content-Disposition
是让浏览器提示用户保存该文件的正确方法。使用HttpResponse.AppendHeader()
添加报头值,例如:
Response.AppendHeader("Content-Type", "...")
Response.AppendHeader("Content-Disposition", "attachment; filename=...")
不隶属于 StackOverflow