How to read/open an FTP file via C#

Asked

Viewed 372 times

0

My scenario is a app where I need to open a file in . PDF; do not download, I want to open it direct.

I found several tutorials where they teach Uploads and Downloads, but none that shows how to read direct.

  • 1

    You have to download the PDF and then open it, FTP is tranferencia, understood?

  • 1

    If you mean by "download" save in a folder you don’t need, but there is no way you can get the pdf data without "downloading" from ftp, as mentioned by @Virgilionovic, but any example you find, when reading (download) the ftp data, you will already have a Stream with the dice, just play this Stream for a browser for example that will already be possible to view the pdf (need to get the bytes)

  • Yes, I understand, I thought you had a more practical and direct way, like accessing a file through a url. ex: ftp://[email protected]/Notasnf/danfes/filename.pdf ... Of course validating access with User and Pass credentials.

  • have as it has, but not by FTP

  • take a look at this library, I’ve used it many times for such operations. https://winscp.net/eng/docs/library

  • Here you have an example of how to open the PDF. You didn’t specify if it’s Web, MVC, Form, but it might serve as an example. But before doing so you need to store the file that is on FTP in a Stream, as @Ricardopunctual already reported. What have you tried? Got something ready?

  • @Georgewurthmann I’m using Form, the indication of Ricardo was very good yes, but I could not codify with the use of Stream, so I ended up doing it in the simplest way, downloading the file.pdf to a directory in a fixed folder and opening the file automatically.

Show 2 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.