views:

11

answers:

1

This is a really strange issue. When using WebClient.DownloadFile in Debug configuration, it appears as if it combines the source and destination paths and tries to do... something. The destination file does get created (but it's empty). The problem dissaperes if I simply switch to Release configuration. Additionally, this used to work just fine, I can't determine what caused this strange behavior.

I'd say it might have something to do with path length but "Debug" < "Release" and that is the only difference between the two destinations when I switch configurations. Both are roughly 150 characters long.

Code:

client.DownloadFile(@"127.0.0.1/website/images/subscriber/test.png",
                                    @"C:\Users\{snip}\bin\Debug\Image Cache\3ea9858bb9e61bc36128bfe24dce35a4.png");

Exception:

Could not find a part of the path 'C:\Users\{snip}\bin\Debug\127.0.0.1\website\images\subscriber\test.png'.

The file is being served up by a WAMP environment, not IIS.

+1  A: 

My guess is that since you're missing a scheme, it's assuming it's a local file.

Try making the first param into something like this instead: "http://127.0.0.1/website/images/subscriber/test.png"

James Manning