Alexander Falkesund Alexander Falkesund - 3 months ago 9 Question

How do I download a TXT and then read it?

Okay so I have a program that is supposed to download a TXT file which ONLY contains a URL from my Dropbox, save it on my desktop, and then open the webbrowser like


My code looks like this:

Dim path As String = "C:\Users\" & SystemInformation.UserName & "\Desktop"
My.Computer.Network.DownloadFile("", path + "\" + "Download_Location" + ".txt")

Dim fileReader As String
fileReader = My.Computer.FileSystem.ReadAllText(path + "\Download_Location.txt")

Now my problem is that, the program DOES download my txt file and name it correctly. But even if I know that there is text in the text file, when the program downloads it and saves it on my Desktop named "Download_Location.txt", it is empty. The downloaded file doesn't conatin any text even if Im 100% sure that there should be a URL text.

And when my program reached the code where
it gives me an error:

You can not start the process because no file name is specified.

Thanks a lot! And sorry for my bad english.


When downloading files via a URL you are required to use a direct URL, due to that you download exactly the URL you specify. The reason you can download it from your web browser is because it first loads the page from the first link, then the page tells the browser to redirect to the actual file.

Direct links through DropBox are accessed via the website, which is what you'll need to get the direct link to your file. The reason DropBox uses this system is probably because is yet a bit shorter than

Having this said, switching your download URL from what you have now to:‌​ui95XjhMUL2Wz4gjzBwiHttuA07RkbOl/file?dl=1 should work.