Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using FTP and clearing out memory
Message
From
25/04/2013 15:03:08
 
 
To
25/04/2013 14:39:55
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01571897
Message ID:
01571906
Views:
32
>I am not sure it this could help but it cannot hurt, I am using the Using\End Using approach to encapsulate the StreamReader class:
>
>
>                        ' FTP setup
>                        loFtpWebRequest = System.Net.FtpWebRequest.Create(New Uri(lcURI))
>                        loFtpWebRequest.Credentials = New System.Net.NetworkCredential(cUsername, cPassword)
>                        loFtpWebRequest.Method = System.Net.WebRequestMethods.Ftp.ListDirectoryDetails
>
>                        ' If we use FTP/SSL  (AUTH SSL)
>                        If nNoFTPProtocol = 2 Then
>                            loFtpWebRequest.EnableSsl = True
>                        End If
>
>                        loFtpWebResponse = loFtpWebRequest.GetResponse()
>
>                        Using loStreamReader As New StreamReader(loFtpWebResponse.GetResponseStream())
>
>                            ' Load the files into the string builder
>                            loStringBuilder.LoadString(loStreamReader.ReadToEnd())
>
>                        End Using
>
>
>This is the part that deals with memory so maybe this could have been a factor.


I was going to suggest something similar

In addition to Disposing of the StreamReader, I think you need to do the same for
loFtpWebResponse.GetResponseStream()  // the stream
loFtpWebResponse 
In addition, could you reuse the following (rather than instantiating each time)
New Uri(lcURI)
New System.Net.NetworkCredential(cUsername, cPassword)
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform