你好,
一旦我得到这个代码来处理任何erros,并下载文件。
现在它给了我一个权限错误,
我没有得到该窗口应该显示的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/*[email protected]"\"+file*/);
f.Write(fileData, 0, fileData.Length);
f.Close();
MessageBox.Show("Completed!");
}
catch(Exception e)
{
MessageBox.Show(e.Message);
}
尝试以管理员身份运行您的应用程序 – 2011-10-09 12:28:24
WinForms或ASP.NET? –
它仍然给我同样的错误...“访问拒绝路径...被拒绝。 “(&for @ShadowWizard,WinForms) – funerr