1

I have a PDF file on my FTP Server. I want to display the PDF file using ASP.Net.

I used google viewer in an iframe control:

<iframe src="http://docs.google.com/gview?url=ftp://samplepdf.com/sample.pdf" style="width:718px; height:700px;" frameborder="0"></iframe>    

It worked perfectly while viewing pdfs from public servers. The problem is that I need to give ftp username and password for the pdf to be displayed on my asp.net page.

Any thoughts?

Thanks in advance


Edit:

I can use url=ftp://username:pass@ftp.samplesite.com/...

but I dont want the username and password to be attached to the url.

I also tried this code:

<div><object data="ftp://username:pass@ftp.website.com/website.com/wwwroot/folderpath/test.pdf" type="application/pdf" width="800" height="1000"> alt : <a href="ftp://username:pass@ftp.website.com/website.com/wwwroot/folderpath/test.pdf">test.pdf</a> </object> </div>    

and it works well. Tho the ftp username and password are still shown in the page source. Any ideas? Thanks

AmrMohallel
  • 126
  • 7

1 Answers1

-1

es simplemente poner un: id="NombreCampo" y asignar igualmente un: runat="server" desde el código en el archivo .aspx, quedaría así: < iframe id="NombreCampo" runat="server" width="400" height="500" style="border: none;"> eso sería lo visible al usuario en el código de la página. desde el codigo de lado del servidor poner la cadena con el FTP: NombreCampo.Src = "https://docs.google.com/viewer?url=ftp://nombreUsuario:pass@ftp.samplesite.com/" + NombreArchivo + " & embedded=true";

¡listo

Yair
  • 1
  • 1