Test Foro de elhacker.net SMF 2.1

Programación => Programación General => .NET (C#, VB.NET, ASP) => Mensaje iniciado por: Keyen Night en 23 Abril 2010, 18:55 PM

Título: Problema al Listar los Archivos [FTP] [RESUELTO]
Publicado por: Keyen Night en 23 Abril 2010, 18:55 PM
Error de principiante xD en FTP los directorios llevan "\" al final sino entonces el ftp los toma como archivos...

Código (vb.net) [Seleccionar]
   Public Function ListDirectory(ByVal dir As String) As List(Of String)
       Dim FTP As FtpWebRequest

       ListDirectory = New List(Of String)

       FTP = CType(WebRequest.Create(New Uri(dir)), FtpWebRequest)
       FTP.Credentials = DefaultCredentials
       FTP.Method = WebRequestMethods.Ftp.ListDirectory
       FTP.UsePassive = False

       Try
           Dim SReader As New StreamReader(FTP.GetResponse.GetResponseStream)

           Dim SString As New String(SReader.ReadLine)

           While Not SString Is Nothing
               ListDirectory.Add(SString) ' - - -> ERROR EN ESTÁ LÍNEA
               SString = SReader.ReadLine
           End While

           SReader.Close()

       Catch
           Return ListDirectory
       End Try
   End Function


Para poder ver detalles del error quite el Try, el error dice así:

No se puede obtener acceso al objeto eliminado. Nombre del objeto: 'System.Net.Sockets.NetworkStream'.

Pero no entiendo porque está eliminado >:(

Alguna otra forma de trabajar con el Stream o hay algo mal?

Gracias.