下载使用ASP.NET .ashx的模块文件 [英] Downloading files using ASP.NET .ashx modules

查看:106
本文介绍了下载使用ASP.NET .ashx的模块文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有ASP.NET页面显示此页面上的某些PDF报表上的iframe中。
当用户从下拉式报告类型,我添加所需的报表数据到ASP.NET会话,并更改iframe的属性SRC到.ashx的,它产生的.PDF报告模块地址。
但是如果没有Adobe咕噜式在浏览器中查看.pdf文件未安装,浏览器建议保存建议文件的报表文件,名称是HandlerName.ashx。
但我要让建议保存文件名为Report.pdf浏览器。我能做到这一点?是否有任何变通办法?

I have ASP.NET page with an iframe on it for displaying some pdf reports on this page. When user select the report type from dropdown, I add the needed for report data into the ASP.NET Session and change the attribute "src" of the iframe to .ashx module address which generates the .pdf report. But if Adobe glug-in for viewing .pdf files in browser is not installed, browser proposes to save report file and name of the proposed file is "HandlerName.ashx". But I want to make the browser proposed to save the file with the name "Report.pdf". Can I do this? Are there any workarounds?

推荐答案

尝试内嵌内容处置,但是我必须检查:

Try inline content-disposition, however I have to check this:

Response.ContentType = "application/pdf"; 
Response.AppendHeader("content-disposition", "inline; filename=" + name ); 

这篇关于下载使用ASP.NET .ashx的模块文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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