Hello:
I am working with VB.NET in a windows form.
I am trying to write a program that loops through several FTP connections. Here is the snippet of code that I am having problems with:
--- Code: ---
Dim listRequest As FtpWebRequest 'FTP request
Dim listResponse As FtpWebResponse 'FTP response
'establishing connection and requesting response
listRequest = CType(WebRequest.Create(path), FtpWebRequest)
listRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails
listResponse = CType(listRequest.GetResponse(), FtpWebResponse) 'stack overflow exception is thrown on this line
--- End code ---
This code is looped through when each FTP connection is established. The code works well until about the 1900th loop then i get a stack overflow error thrown.
My question is why am I getting a stack overflow error? I don't see how a stack overflow can occur with the above code.
Exact error message: "An unhandled exception of type 'System.StackOverflowException' occurred in System.dll"
Any help would be appreciated.
Thanks.
I am working with VB.NET in a windows form.
I am trying to write a program that loops through several FTP connections. Here is the snippet of code that I am having problems with:
--- Code: ---
Dim listRequest As FtpWebRequest 'FTP request
Dim listResponse As FtpWebResponse 'FTP response
'establishing connection and requesting response
listRequest = CType(WebRequest.Create(path), FtpWebRequest)
listRequest.Method = WebRequestMethods.Ftp.ListDirectoryDetails
listResponse = CType(listRequest.GetResponse(), FtpWebResponse) 'stack overflow exception is thrown on this line
--- End code ---
This code is looped through when each FTP connection is established. The code works well until about the 1900th loop then i get a stack overflow error thrown.
My question is why am I getting a stack overflow error? I don't see how a stack overflow can occur with the above code.
Exact error message: "An unhandled exception of type 'System.StackOverflowException' occurred in System.dll"
Any help would be appreciated.
Thanks.