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"
);