你好,
一旦我得到這個代碼來處理任何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