Asp.net-Mvc-4
如何在 iframe src 中使用 Url.Action
如何使用屬性
Url.Action中的方法。iframesrc喜歡<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>
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"); }