WebClient: отказано в доступе - C#
Формулировка задачи:
Есть код
При попытке запустить выводит System.Net.WebException: Исключение во время запроса WebClient. -->System.UnauthorizeAccessException: отказано в доступе по пути "J:\Downloads\c#
Using System.Net; и Using System.IO; присутствуют.
Что делать?
namespace testDown
{
class Program
{
static void Main(string[] args)
{
string source = "какой-то адрес/dpapi/DPAPI.exe";
string target = Directory.GetCurrentDirectory();
WebClient webClient = new WebClient();
webClient.DownloadFile(source, target);
Console.WriteLine("Закачано");
Console.ReadLine();
}
}
}Решение задачи: «WebClient: отказано в доступе»
textual
Листинг программы
string target = Path.Combine(Directory.GetCurrentDirectory(), "DPAPI.exe");