Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The realization method of online viewing PDF File in ftp Server

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

URL form:

/ / http://localhost:2692/PDFVIEWER/web/viewer.html?file=http://localhost:2692/TOV/DASystem/GetStreaem?path%3Dftp://ftp account: ftp password @ IP address / 0001/E_File3/2017526/test.PDF

Note: PDFVIEWER/web/viewer.html is a PDF plug-in address link

Background method, which converts the PDF file on the ftp server into a binary stream for reading

Using System.Net;public FileStreamResult GetStreaem (string path) {var reqFtp = (FtpWebRequest) WebRequest.Create (new Uri (path)); reqFtp.Method = WebRequestMethods.Ftp.DownloadFile;reqFtp.UseBinary = true;//reqFTP.Credentials = new NetworkCredential (ftpUserID, ftpPassword); reqFtp.UsePassive = false; / / choose active or passive mode. ReqFtp.KeepAlive = false;// must set this property, otherwise an exception will occur when downloading multiple files at one time. Var response = (FtpWebResponse) reqFtp.GetResponse (); var ftpStream = response.GetResponseStream (); return File (ftpStream, "application/pdf", "ib70guide.pdf");}

The above ftp server PDF file online view of the implementation method is the editor to share with you all the content, I hope to give you a reference, but also hope that you support more.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report