Hi, I am trying to use webclient.downloadfile.  I have a virtual folder set up with a particular user.  The file is in the folder I want to download from, all is correct there, but when I try to download, I receive a "Not found" error.  I have tried a million settings but am about to give up.  The file is kind of big, so I don't know if that's an issue, but here's my code:  

sURL = sURL.Substring(0, sURL.LastIndexOf("/") + 1) & "p.db"
webfile = New WebClient
Dim mycache As CredentialCache = New CredentialCache
mycache.Add(New Uri(sURL), "Basic", New NetworkCredential("validuser", "validpassword"))
webfile.Credentials = mycache
webfile.DownloadFile(sURL, sPath & "p.db")

I just added the cache stuff today.  The user isn't really a basic user, it's added in under Anonymous Access.

Oh yes, I don't think this is using the default port, don't know if that matters.

Anyone know why I would get a file  not found error?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

The following will help:

WebClient.DownloadFile only see's Local????

camarottaAuthor Commented:
thanks Nauman.  I don't think this is what I'm looking for though, I'm downloading from a url, not a filepath.  The URL is correct & the file is there.

camarottaAuthor Commented:
OK, I'm making some progress on narrowing down the cause of the problem, has nothing to do with ports or proxy servers or anything like that.

I'm trying to download a sql db backup file.  It's not a standard type of MIME file.  I can download .txt files, and .xls files just fine and dandy, but not that backup file.  My theory is

1.  The file size, but I don't think that's it.
2.  The type of file it is

So is there a way to add a content type to the webclient?  I've tried to do webclient.Headers.Add("Content-Type", "application/x-msdownload") and things like that, but it's not helping.

Can anyone help me?

camarottaAuthor Commented:
So, do I get points for answering my own question?  I just got this working this morning.  I went into IIS, to the Default Web properties and added the mim-type binary/octet-stream for files with a .db extension.  Worked unbelievably.

PAQed with points refunded (500)

Community Support Moderator

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.