t get a password to enter,this folder get a password (of course i insert the password ) because its deny access and to be canceled from person without permission so i’m looking how download files from that folder with C# . Before i tried to download files but Visual Studio got an error: ‘Access Denied’! Do you have any advice how download files from a Folder with Password or its impossible? Thanks a lot!
Nice Regards.
EDIT : Here is the code snippet that i use to download the files from a folder
private List<string> GetFolder(string Folder) { DirectoryInfo dir = new DirectoryInfo(Folder); FileInfo[] files = dir.GetFiles('*.mp3',SearchOption.AllDirectories); List<string> str = new List<string>(); foreach (FileInfo file in files) { str.Add(file.FullName); } return str; } private void Form1_Load(object sender, EventArgs e) { GetFolder(@'D:\\Music\\') }
Sorry i forget to add the code before.
If you’re downloading files using a URL, you can specify the username and password in the URL:
http://user:pass@host/pathObviously, if your username or (more likely) password has funny characters, these need to be %XX encoded appropriately.