こんにちは、
このコードをエラーなしで動作させると、ファイルがダウンロードされました。
これで、アクセス許可エラーが発生
します。ウィンドウに表示されるはずのacesscontrolポップアップが表示されません。
とにかく、
どうすればこのコードを取得してファイルをダウンロードできますか?
WebClient request = new WebClient();
request.Credentials = new NetworkCredential(txtFTPuser.Text, txtFTPpassword.Text);
byte[] fileData = request.DownloadData(fullDownloaPath);//dnoces.dreamhost.com
FileSecurity security = File.GetAccessControl(downloadTo);
FileSystemAccessRule rule = new FileSystemAccessRule(@"BUILTIN\Users",
FileSystemRights.FullControl, AccessControlType.Allow);
File.SetAccessControl(downloadTo, security);
try
{
FileStream f = File.Create(downloadTo/*+@"\"+file*/);
f.Write(fileData, 0, fileData.Length);
f.Close();
MessageBox.Show("Completed!");
}
catch(Exception e)
{
MessageBox.Show(e.Message);
}