?
Solved

webclient.downloadfile

Posted on 2006-03-30
6
Medium Priority
?
1,672 Views
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?

Thanks,
Carol
0
Comment
Question by:camarotta
  • 3
5 Comments
 
LVL 25

Expert Comment

by:nauman_ahmed
ID: 16337807
The following will help:

WebClient.DownloadFile only see's Local????
http://www.codecomments.com/message508524.html

-Nauman.
0
 

Author Comment

by:camarotta
ID: 16337846
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.

Carol
0
 

Author Comment

by:camarotta
ID: 16366691
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?

Thanks!
Carol
0
 

Author Comment

by:camarotta
ID: 16371026
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.

Carol
0
 

Accepted Solution

by:
GranMod earned 0 total points
ID: 16571668
PAQed with points refunded (500)

GranMod
Community Support Moderator
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Lots of people ask this question on how to extend the “MembershipProvider” to make use of custom authentication like using existing database or make use of some other way of authentication. Many blogs show you how to extend the membership provider c…
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…
Screencast - Getting to Know the Pipeline
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

850 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