ASP.NET显示PDF文件的用户,而不是"保存为"对话 [英] ASP.NET show PDF file to user instead of "save as" dialog
本文介绍了ASP.NET显示PDF文件的用户,而不是"保存为"对话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的ASP.NET应用程序返回的PDF文件到用户使用以下
My ASP.NET application return PDF file to user using code below
Context.Response.Clear();
Context.Response.ContentType = "application/pdf";
Context.Response.TransmitFile(optionEntityCmd.PathToSave);
Context.Response.End();
这code显示另存为浏览器对话框,这可能不是另存为对话框加载PDF文件直接在浏览器?
This code show Save As browser dialog, is it possible instead of Save As dialog load PDF file directly in browser?
推荐答案
您可以附加的内容处置头:
Context.Response.AppendHeader(
"Content-Disposition",
"inline; filename=foo.pdf"
);
这篇关于ASP.NET显示PDF文件的用户,而不是"保存为"对话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文