Posted on 2006-03-30
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?

Question by:camarotta
    LVL 25

    Expert Comment

    The following will help:

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


    Author Comment

    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.


    Author Comment

    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?


    Author Comment

    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.


    Accepted Solution

    PAQed with points refunded (500)

    Community Support Moderator

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now