C# 将新创建的pdf显示到其他选项卡
这就是我要做的。当我点击超链接时,它会打开一个新标签,然后显示我新创建的pdf。但我的代码一直在当前选项卡上显示它 查看代码C# 将新创建的pdf显示到其他选项卡,c#,asp.net-mvc,C#,Asp.net Mvc,这就是我要做的。当我点击超链接时,它会打开一个新标签,然后显示我新创建的pdf。但我的代码一直在当前选项卡上显示它 查看代码 @Html.ActionLink("User", "PRintPDF", new { target = "_blank" }) 和控制器 Response.ContentType = "application/pdf"; Response.AddHeader("content-length", renderedBytes.Length.ToString(
@Html.ActionLink("User", "PRintPDF", new { target = "_blank" })
和控制器
Response.ContentType = "application/pdf";
Response.AddHeader("content-length", renderedBytes.Length.ToString());
Response.AddHeader("Content-Disposition", "inline;filename=somefile.pdf");
Response.BinaryWrite(renderedBytes);
Response.Flush();
试试你的观点
@Html.ActionLink("User", "PRintPDF", new {id = 1}, new {@target="_blank"})
actionlink应该有4个html属性参数。这应该适用于大多数浏览器。你用的是什么操作系统和浏览器?我也是这么想的。我的操作系统使用FF版本39.0和windows 7。