Last post May 25, 2021 02:28 AM by robby32
May 24, 2021 03:59 AM|robby32|LINK
I have a files share and am wanting to do 2 separate things .
I have created a file share and can access from file explorer bt the user needs to enter username and password.
I want to automate this so that the user just clicks on the share as follows:
\\<vm ip address>\<share folder>\myfile.exe
and it automatically downloads the file, not install it.
Also I have a text file in the share directory , how can i read its contents ?
May 25, 2021 02:24 AM|Sean Fang|LINK
What do you mean "file share" here?
Is it an application that you create?
If you want to implement the file download functionality for a FTP server, you might need
FtpWebRequest Class. Or
WebClient Class if you want to download the resource with the specified URI to a local file using
You can refer to below codes for reference and modify them for your real scenario.
private void DownloadFileFTP()
string inputfilepath = @"C:\Temp\FileName.exe";
string ftphost = "xxx.xx.x.xxx";
string ftpfilepath = "/Updater/Dir1/FileName.exe";
string ftpfullpath = "ftp://" + ftphost + ftpfilepath;
using (WebClient request = new WebClient())
request.Credentials = new NetworkCredential("UserName", "Password");
byte fileData = request.DownloadData(ftpfullpath);
using (FileStream file = File.Create(inputfilepath))
file.Write(fileData, 0, fileData.Length);
WebClient Client = new WebClient ();
May 25, 2021 02:28 AM|robby32|LINK
Thankyou exactly what i was looking for , i didnt get the username and password part correct. Now i know how to use it .