简体   繁体   English

HTTP标头(c#)中内容处置的替代方法

[英]Alternative to Content-Disposition in HTTP Header (c#)

Is there an alternative for Content-Disposition with "attachment; filename=..."? 是否可以使用“ attachment; filename = ...” 替换 Content-Disposition?

I'm sending a streamed on the fly exe file and wish the browser to open the "save as" or "run" when I begin sending. 我正在发送一个实时exe文件流,希望浏览器在我开始发送时打开“另存为”或“运行”。

I'm using the C# HttpResponseHeader and wish to use its members or the HttpWorkerRequest members. 我正在使用C#HttpResponseHeader,并希望使用其成员或HttpWorkerRequest成员。

Thanks, Moshe 谢谢,Moshe

Content-Disposition is the correct way to get the browser to prompt the user to save the file. Content-Disposition是使浏览器提示用户保存文件的正确方法。 Use HttpResponse.AppendHeader() to add the header value, eg: 使用HttpResponse.AppendHeader()添加标头值,例如:

Response.AppendHeader("Content-Type", "...") 
Response.AppendHeader("Content-Disposition", "attachment; filename=...") 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM