Open a file when it downloads with HttpContext

旧城冷巷雨未停 提交于 2019-12-25 08:02:49

问题


I have a handler that I call when a link gets clicked. This handler gets the file contents from the DB and writes the contents to context.Response. I'd like to open this file as well along with it getting downloaded. Is this possible?


回答1:


You have no control over browser's behavior. It will either open in browser OR display open/save dialog.

You may try to render custom page with HTML view of the file and automatically trigger second download from that HTML page to force open/save dialog.




回答2:


no. it is not.

if its a bitmap file - then maybe becuase it doesnt have to be fully downloaded...

but forget about it. it is not the right way.

you cant open a file while it is being downloaded - its a filesystem - restriction



来源:https://stackoverflow.com/questions/10340213/open-a-file-when-it-downloads-with-httpcontext

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!