开发者

Access to the path is denied when programmatically downloading a file from ftp in C# on Win7 64bit

I'm using the C# framework REBEX to download file(s) from an FTP on Win7 64bit in VS2008.

After I press F5 to start debugging, I get an error that Access to the path I'm downloading to is denied.

I believe this may be due to UAC and elevated permissions issues on Win7/Vista. I did some research and found some information on app.manifest, b开发者_如何学Cut when I change the requestedExecutionLevel in the app.manifest, it mentions that it isn't compatible with ClickOnce Security Settings. So I disabled ClickOnce only to have it automatically re-enable itself when building the project or debugging. And yes, I've enabled full security privileges for all users on the folder, and yes I've tried sending the files to my ...\AppData\Roaming\


Stupid me. Turns out I wasn't setting the full local filepath. Just to help anyone else in my predicament...

This will create an access denied exception:

client.GetFile(item.Name, @"C:\DIR\");

And this will get you the file you want:

client.GetFile(item.Name, @"C:\DIR\" + item.Name);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜