|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Jun 2001
Città: Catania
Messaggi: 2690
|
[VB 2010] - Chiarimento su problema funzione
Salve ragazzi,
ho ceato questa funzione che mi permette di visualizzare in una griglia il contenuto di una directory di un mio ftp: Codice:
Public Function GetFileList(ByVal path As String, ByVal MyList As ListBox) As List(Of String)
Dim retList = New List(Of String)
If (path = Nothing Or path = "") Then
path = "/"
End If
_FtpRequest = CType(WebRequest.Create("ftp://" + _Host + path), FtpWebRequest)
_FtpRequest.Credentials = New NetworkCredential(_UserName, _Password)
Try
_FtpRequest.UsePassive = False
Catch
MessageBox.Show("Check your firewall configuration")
Exit Function
End Try
_FtpRequest.UsePassive = True
_FtpRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails
_FtpRequest.EnableSsl = _UseSSL
_FtpRequest.Proxy = Nothing
_FtpResponse = CType(_FtpRequest.GetResponse(), FtpWebResponse)
Dim sr As New IO.StreamReader(_FtpRequest.GetResponse().GetResponseStream())
Dim str As String = sr.ReadLine()
While Not str Is Nothing
If Not str.StartsWith(".") Then
MyList.Items.Add(str)
End If
str = sr.ReadLine()
End While
sr.Close()
sr.Dispose()
sr = Nothing
_FtpRequest = Nothing
Return retList
End Function
![]() Come posso risolvere? Grazie
__________________
Unisciti a noi: http://www.swproduction.altervista.org/ - http://www.enews.altervista.org/
|
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 17:35.




















