1
在我的应用程序中,我在我的解决方案中有一个pdf文档,当用户单击某个特定按钮时,文档必须在弹出窗口中打开。我可以通过返回文件流对象在同一窗口中打开它。我使用的代码。MVC在弹出窗口中打开PDF
public ActionResult ShowPdf()
{
if (System.IO.File.Exists(Server.MapPath("~/downloads/MyPdf.pdf")))
{
string pathSource = Server.MapPath("~/downloads/MyPdf.pdf");
FileStream fsSource = new FileStream(pathSource, FileMode.Open, FileAccess.Read);
return new FileStreamResult(fsSource, "application/pdf");
}
else
{
return RedirectToAction("Index", "User");
}
}
我怎样才能加载相同的弹出式窗口中提前