简体   繁体   中英

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

Is there an alternative for Content-Disposition with "attachment; filename=..."?

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.

I'm using the C# HttpResponseHeader and wish to use its members or the HttpWorkerRequest members.

Thanks, Moshe

Content-Disposition is the correct way to get the browser to prompt the user to save the file. Use HttpResponse.AppendHeader() to add the header value, eg:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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