View ftp Server PDF files online, ftp Server PDF files
URL format:
// Http: // localhost: 2692/javasviewer/web/viewer.html? File = http: // localhost: 2692/TOV/DASystem/GetStreaem? Path % 3 Dftp: // ftp account: ftp password @ IP Address/0001/E_File3/2017526/test. PDF
Note: PDFVIEWER/web/viewer.html is a PDF plug-in URL link.
Background MethodConvert the PDF file on the ftp server to 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; // select active or passive mode.
ReqFtp. KeepAlive = false; // you must set this attribute. Otherwise, an exception occurs when multiple files are downloaded at a time.
Var response = (FtpWebResponse) reqFtp. GetResponse ();
Var ftpStream = response. GetResponseStream ();
Return File (ftpStream, "application/pdf", "ib70guide.pdf ");
}