From: Bill N on
I have the need to access an ftp server within a VB.NET app to issue GET
command to download files.
The ftp command lines are below (with actual loin info withhold):

> ftp
> open ftp.myftpserver.com
User: myuserID
Password: mypassword
> /get ./ReceiveFiles/GetFileV2/MyAccount {myLocalFilePath}

It's the GET command that caused problem for me. This GET command will
trigger the FTP server to render the file and send it to the specified
localFilePath.

I prefer to use MS Utilities.FTP.FTPClient (System.Net) to get the thing
done, but cannot figure out how to pass this GET command line to the ftp
server. All I found in Utilities.FTP.FTPClient is
GetFileSize
GetHashCode
GetType

If it's not possible to use System.Net FTP.FTPCLient utilities then I need
help forming the ftp script to run with ProcessStart.
Your help is greatly appreciated.

Bill



From: Patrice on
Hello,

Try "How to: Download Files with FTP" :

http://msdn.microsoft.com/en-us/library/ms229711.aspx
--
Patrice




From: Cor Ligthert[MVP] on
Why not the ftpwebrequest class?


http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest(VS.80).aspx

"Bill N" <billn(a)jaco.com> wrote in message
news:unVZzDW5KHA.4644(a)TK2MSFTNGP02.phx.gbl...
> I have the need to access an ftp server within a VB.NET app to issue GET
> command to download files.
> The ftp command lines are below (with actual loin info withhold):
>
>> ftp
>> open ftp.myftpserver.com
> User: myuserID
> Password: mypassword
>> /get ./ReceiveFiles/GetFileV2/MyAccount {myLocalFilePath}
>
> It's the GET command that caused problem for me. This GET command will
> trigger the FTP server to render the file and send it to the specified
> localFilePath.
>
> I prefer to use MS Utilities.FTP.FTPClient (System.Net) to get the thing
> done, but cannot figure out how to pass this GET command line to the ftp
> server. All I found in Utilities.FTP.FTPClient is
> GetFileSize
> GetHashCode
> GetType
>
> If it's not possible to use System.Net FTP.FTPCLient utilities then I need
> help forming the ftp script to run with ProcessStart.
> Your help is greatly appreciated.
>
> Bill
>
>
>
>
From: Bill N on
Thank you Cor and Patrice!
I have 2 questions:
1. Can I use this with VS2005 instead of VS 2008?
2. I am not well versed with C# (that's why my question is in this NG). I
believe the codes below can help me with the GET command line I mentioned
previously, but I don't know how to do it in VB.
Can someone please give me a hint?

Thanks
Bill

--------------------------


public static bool DisplayFileFromServer(Uri serverUri)
{
// The serverUri parameter should start with the ftp:// scheme.
if (serverUri.Scheme != Uri.UriSchemeFtp)
{
return false;
}
// Get the object used to communicate with the server.
WebClient request = new WebClient();

// This example assumes the FTP site uses anonymous logon.
request.Credentials = new NetworkCredential
("anonymous","janeDoe(a)contoso.com");
try
{
byte [] newFileData = request.DownloadData (serverUri.ToString());
string fileString =
System.Text.Encoding.UTF8.GetString(newFileData);
Console.WriteLine(fileString);
}
catch (WebException e)
{
Console.WriteLine(e.ToString());
}
return true;
}



"Cor Ligthert[MVP]" <Notmyfirstname(a)planet.nl> wrote in message
news:O3d0SXW5KHA.5952(a)TK2MSFTNGP04.phx.gbl...
Why not the ftpwebrequest class?


http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest(VS.80).aspx

"Bill N" <billn(a)jaco.com> wrote in message
news:unVZzDW5KHA.4644(a)TK2MSFTNGP02.phx.gbl...
> I have the need to access an ftp server within a VB.NET app to issue GET
> command to download files.
> The ftp command lines are below (with actual loin info withhold):
>
>> ftp
>> open ftp.myftpserver.com
> User: myuserID
> Password: mypassword
>> /get ./ReceiveFiles/GetFileV2/MyAccount {myLocalFilePath}
>
> It's the GET command that caused problem for me. This GET command will
> trigger the FTP server to render the file and send it to the specified
> localFilePath.
>
> I prefer to use MS Utilities.FTP.FTPClient (System.Net) to get the thing
> done, but cannot figure out how to pass this GET command line to the ftp
> server. All I found in Utilities.FTP.FTPClient is
> GetFileSize
> GetHashCode
> GetType
>
> If it's not possible to use System.Net FTP.FTPCLient utilities then I need
> help forming the ftp script to run with ProcessStart.
> Your help is greatly appreciated.
>
> Bill
>
>
>
>
From: Cor Ligthert[MVP] on
It uses framework 2.0 so VB 2005

For this purpose the snippet converter does nice work.

http://www.tangiblesoftwaresolutions.com/Product_Details/Instant_VB.html


"Bill N" <billn(a)jaco.com> wrote in message
news:esmGL$W5KHA.3292(a)TK2MSFTNGP06.phx.gbl...
> Thank you Cor and Patrice!
> I have 2 questions:
> 1. Can I use this with VS2005 instead of VS 2008?
> 2. I am not well versed with C# (that's why my question is in this NG). I
> believe the codes below can help me with the GET command line I mentioned
> previously, but I don't know how to do it in VB.
> Can someone please give me a hint?
>
> Thanks
> Bill
>
> --------------------------
>
>
> public static bool DisplayFileFromServer(Uri serverUri)
> {
> // The serverUri parameter should start with the ftp:// scheme.
> if (serverUri.Scheme != Uri.UriSchemeFtp)
> {
> return false;
> }
> // Get the object used to communicate with the server.
> WebClient request = new WebClient();
>
> // This example assumes the FTP site uses anonymous logon.
> request.Credentials = new NetworkCredential
> ("anonymous","janeDoe(a)contoso.com");
> try
> {
> byte [] newFileData = request.DownloadData (serverUri.ToString());
> string fileString =
> System.Text.Encoding.UTF8.GetString(newFileData);
> Console.WriteLine(fileString);
> }
> catch (WebException e)
> {
> Console.WriteLine(e.ToString());
> }
> return true;
> }
>
>
>
> "Cor Ligthert[MVP]" <Notmyfirstname(a)planet.nl> wrote in message
> news:O3d0SXW5KHA.5952(a)TK2MSFTNGP04.phx.gbl...
> Why not the ftpwebrequest class?
>
>
> http://msdn.microsoft.com/en-us/library/system.net.ftpwebrequest(VS.80).aspx
>
> "Bill N" <billn(a)jaco.com> wrote in message
> news:unVZzDW5KHA.4644(a)TK2MSFTNGP02.phx.gbl...
>> I have the need to access an ftp server within a VB.NET app to issue GET
>> command to download files.
>> The ftp command lines are below (with actual loin info withhold):
>>
>>> ftp
>>> open ftp.myftpserver.com
>> User: myuserID
>> Password: mypassword
>>> /get ./ReceiveFiles/GetFileV2/MyAccount {myLocalFilePath}
>>
>> It's the GET command that caused problem for me. This GET command will
>> trigger the FTP server to render the file and send it to the specified
>> localFilePath.
>>
>> I prefer to use MS Utilities.FTP.FTPClient (System.Net) to get the thing
>> done, but cannot figure out how to pass this GET command line to the ftp
>> server. All I found in Utilities.FTP.FTPClient is
>> GetFileSize
>> GetHashCode
>> GetType
>>
>> If it's not possible to use System.Net FTP.FTPCLient utilities then I
>> need
>> help forming the ftp script to run with ProcessStart.
>> Your help is greatly appreciated.
>>
>> Bill
>>
>>
>>
>>
>