2013-07-16 21 views
6

Come utilizzare il metodo Url.Action nell'attributo iframesrc. Mi piaceCome utilizzare Url.Azione in iframe src

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

Ma non funziona correttamente. Sta dicendo che il contenuto richiesto non è disponibile.

Please help me

risposta

10

utilizzando il motore di ASP.NET

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

utilizzando il motore di rasoio.

<iframe src = '@Url.Action("HelloWorld", "myController")' width = "100%" 
    height="1000" frameBorder="0"></iframe> 
0
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"); 
     } 
Problemi correlati