C# Access to the path is denied… Client.Download(filelink, path)

DanielL

New Member
everyone. First of all: Sorry for my bad English, I'm Italian...I've a problem with my code: when I try to download a file from dropbox, and put it in my Roaming folder something goes wrong, here's the error Log:System.Net.WebException: An exception occurred during a WebClient request. ---> System.UnauthorizedAccessException: Access to the path'C:\Users\Marco\AppData\Roaming.maycraft' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access) at System.Net.WebClient.DownloadFile(Uri address, String fileName) --- End of inner exception stack trace --- at System.Net.WebClient.DownloadFile(Uri address, String fileName) at System.Net.WebClient.DownloadFile(String address, String fileName) at MayCraftLauncher.Program.downloadExist() in c:\Users\Marco\Desktop\MayCraftLauncher\C# SourceCode\MayCraftLauncher\MayCraftLauncher\Program.cs:line 71Obviously I tried to run Visual Studio with administator rights, but nothing...And here's the code:\[code\]using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Net;using System.Security.Principal;using System.IO;using System.IO.Compression;using Ionic.Zip;namespace MayCraftLauncher{ class Program { public static System.Threading.Thread existDownloading = new System.Threading.Thread(downloadExist); public static string userName = Environment.UserName; public static string path = @"C:\Users\" + userName + @"\AppData\Roaming\.maycraft\Exist"; public static string maypath = @"C:\Users\" + userName + @"\AppData\Roaming\.maycraft"; static void Main(string[] args) { folderExist(); } static void check1() { while (!Directory.Exists(maypath)) { System.Threading.Thread.Sleep(5000); } existDownloading.Start(); } static void folderExist() { if (!Directory.Exists(maypath)) { System.Diagnostics.Process.Start(@"C:\Users\Marco\Desktop\MayCraftLauncher.jar"); check1(); } else { fileExist(); } } static void fileExist() { if (File.Exists(path)) //Determina se
 
Back
Top