We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now



camarotta asked
Medium Priority
Last Modified: 2007-12-19
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?

Watch Question

The following will help:

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



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.



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?



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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.