Asp.net mvc 4 如何在iframe src中使用Url.Action

Asp.net mvc 4 如何在iframe src中使用Url.Action,asp.net-mvc-4,iframe,url-action,Asp.net Mvc 4,Iframe,Url Action,如何使用iframesrc属性中的Url.Action方法。像 <iframe src = '<%=Url.Action("HelloWorld", "myController");%>' width = "100%" height="1000" frameBorder="0"></iframe> 但它不能正常工作。它说请求的内容不可用 请帮助我使用ASP.NET引擎 <iframe src = '<%: Url.Action("HelloW

如何使用
iframe
src
属性中的
Url.Action
方法。像

<iframe src = '<%=Url.Action("HelloWorld", "myController");%>' width = "100%" height="1000" frameBorder="0"></iframe>

但它不能正常工作。它说请求的内容不可用

请帮助我使用ASP.NET引擎

<iframe src = '<%: Url.Action("HelloWorld", "myController") %>' width = "100%" 
    height="1000" frameBorder="0"></iframe>

使用剃须刀引擎

<iframe src = '@Url.Action("HelloWorld", "myController")' width = "100%" 
    height="1000" frameBorder="0"></iframe>

在获取控制器类型时发现相同错误?因此,如果您使用iframeforpdf查看器,这是最好的解决方案,我希望这段代码会有用。
公共文件流结果GetPDF()
{
var path=“E:\\FirstTask\\FirstTask\\FolderToSave\\Patient approvement.pdf”;
FileStream fs=newfilestream(路径,FileMode.Open,FileAccess.ReadWrite);
返回文件(fs,“应用程序/pdf”);
}
Same here found error in getting what type of Controller should be? so this is the best solution if you are using IFrame for PDF Viewer and I hope this code will be useful.


<iframe src="@Url.Action("GetPDF")" id="sign" width="800" height="800"></iframe>

  public FileStreamResult GetPDF()
        {
            var path = "E:\\FirstTask\\FirstTask\\FolderToSave\\Patient Consent.pdf";
            FileStream fs = new FileStream(path, FileMode.Open, FileAccess.ReadWrite);
            return File(fs, "application/pdf");
        }