打开一个文件时,它的HttpContext下载 [英] Open a file when it downloads with HttpContext

查看:187
本文介绍了打开一个文件时,它的HttpContext下载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个处理程序我打电话的时候,一个链接被点击。该处理器会从数据库文件内容和内容写入context.Response。我想打开此文件,以及与它越来越下载一起。这可能吗?

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?

推荐答案

您有超过浏览器的行为没有控制权。它要么在浏览器中打开或显示打开/保存对话框。

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

您可以尝试呈现的自定义页面文件的HTML视图,并自动从HTML页面触发第二次下载强行打开/保存对话框。

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.

这篇关于打开一个文件时,它的HttpContext下载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆