1
I would like to view a file .PDF
staying at a FTP
.
I can get the Stream
through the bytes, but I can’t create the file in a browser.
Follow the code so far:
private void btnVerFilePdf_Click(object sender, EventArgs e)
{
WebClient request = new WebClient();
string url = "ftp://nfsaai.com.br@hostip/" + "fileexample.pdf";
request.Credentials = new NetworkCredential("userstr", "passwordstr");
try
{
byte[] newFileData = request.DownloadData(url);
string fileString = System.Text.Encoding.UTF8.GetString(newFileData);
Console.WriteLine(fileString);
}
catch (Exception error)
{
MessageBox.Show(String.Format("erro : {0}", error.Message));
}
}
Windowsform or Webforms?
– Leandro Angelo
Windowsform....
– Maurício Sanches
In that case you will need a component to display in your application or save it locally and open the file
– Leandro Angelo
Got it @Leandroangelo I thought I could with the bytes caught build the document in a browser.
– Maurício Sanches
Maybe with Base64 I’ll even get
– Leandro Angelo