内容处置文件名不工作的IE浏览器 [英] Content-Disposition Filename not working on IE

查看:200
本文介绍了内容处置文件名不工作的IE浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个asp.net/c# Web应用程序,允许用户查看和下载PDF文件。当我点击一个文件,我去查看,在浏览器中提供的PDF阅读器,当我保存它,该文件应与我已经通过头传递的名称保存。但是,这不是在IE7和放大器的行为; IE8

I am working on an asp.net/c# web application that allows users to view and download PDF files. When I am clicking on a file, I get to view that in the PDF reader available in the browser, and when I save it, the file should be saved with the name that I have passed via headers. But this is not the behavior in IE7 & IE8

FileInfo f = new FileInfo(FileName);
Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", "inline; filename=" + f.Name)

当我点击保存文件,那我送过不被用来保存文件的文件名,但在URL中aspx页面的文件名上当受骗。这是IE浏览器的错误。当我尝试在谷歌浏览器,一切工作正常。

When I click to save a file, the filename that I am sending over is not being used to save the file, but the filename of the aspx page in the url is being taken. Is this is a bug in IE. Everything works fine when I try it on Google chrome.

推荐答案

尝试 Response.AddHeader(内容处置,附件;文件名= \\+ f.name +\\ ); 内联是不是IE下工作7-8

Try Response.AddHeader("Content-Disposition", "attachment;filename=\"" + f.name + "\""); Inline is not working under IE 7-8.

这篇关于内容处置文件名不工作的IE浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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