I have this code that downloads file from ftp server and then it creates that file in path that is set.
string inputfilepath = @"C:\Users\me\Documents\Test";
string ftphost = "ftp_server";
string ftpfilepath = @"/TestDOTNET/text.TXT";
string ftpfullpath = "ftp://" + ftphost + ftpfilepath;
using (WebClient request = new WebClient())
{
request.Proxy = null;
request.Credentials = new NetworkCredential("user", "pass");
byte[] fileData = request.DownloadData(ftpfullpath);
File.SetAttributes(inputfilepath, FileAttributes.Normal);
using (FileStream file = File.Create(inputfilepath)) // this is the line where I get the exception
{
file.Write(fileData, 0, fileData.Length);
file.Close();
}
MessageBox.Show("Download Complete");
}
I tried to create app.manifest and set requestedExcetuion level to requireAdministrator but still got no change.
Thank you for your time