Dear Aspose-Team,
we’re currently using the class FtpClient and aspecialy the Method Download (see subject). If we try to execute the following code:
using System;we receice the exception by trying to use the stream:
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Aspose.Network.Ftp;
using System.IO;namespace FtpTestApplication
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}<span style="color:blue;">private</span> <span style="color:blue;">void</span> buttGetFTP_Click(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">EventArgs</span> e) { <span style="color:#2b91af;">FtpClient</span> ftpClient; ftpClient = <span style="color:blue;">new</span> <span style="color:#2b91af;">FtpClient</span>(<span style="color:#a31515;">"kutest-ftp"</span>, 80, <span style="color:#a31515;">"TestLogin"</span>, <span style="color:#a31515;">"TestPassword"</span>); ftpClient.TransferType = <span style="color:#2b91af;">TransferType</span>.Binary; ftpClient.Connect(<span style="color:blue;">true</span>); <span style="color:#2b91af;">ListItem</span>[] Lst; Lst = ftpClient.ListDirectoryDetails(<span style="color:#a31515;">"TestFolder"</span>); <span style="color:blue;">string</span>[] FileList = <span style="color:blue;">new</span> <span style="color:blue;">string</span>[Lst.Count()]; <span style="color:blue;">int</span> i = 0; <span style="color:blue;">foreach</span> (<span style="color:#2b91af;">ListItem</span> itm <span style="color:blue;">in</span> Lst) { FileList[i++] = itm.Name; } ftpClient.ChangeDirectory(<span style="color: rgb(163, 21, 21);">"</span><span style="color:#a31515;">TestFolder</span><span style="color:#a31515;">"</span>); <span style="color:#2b91af;">Stream</span> stmReader = <span style="color:blue;">new</span> <span style="color:#2b91af;">MemoryStream</span>(); ftpClient.Download(FileList[0], stmReader); } }
}
“Cannot access a closed Stream.”.
So, what is the right way to use this method and to use the given Stream?
Thanks for answers!
Greetings from Germany,
Stephan