Click here to Skip to main content
15,908,775 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
i want to download data from URL which i have stored in Notepad. so i have added an open file dialog so that user can open the text file. by clicking on download button i want to download those links data directly to my computer.. so is there is any code for downloading data from URL??
Posted
Comments
Sergey Alexandrovich Kryukov 10-Apr-13 13:47pm    
In notepad? Doh...
—SA
shashank 1068 10-Apr-13 13:49pm    
yes in notepad

1 solution

 
Share this answer
 
Comments
shashank 1068 10-Apr-13 12:27pm    
its not working :(
DinoRondelly 10-Apr-13 12:30pm    
Whats not working? Are you getting any errors?
shashank 1068 10-Apr-13 12:32pm    
i am getting an error which says

Value cannot be null. Parameter name: address
DinoRondelly 10-Apr-13 12:33pm    
Step through your code and see if the parameter is being set properly. Post your code and ill take a look
shashank 1068 10-Apr-13 12:35pm    
Console.Write(ControlChars.Cr + "Please enter a Url(for example, http://www.msn.com): ")
Dim remoteUrl As String = Console.ReadLine()
' Create a new WebClient instance.
Dim myWebClient As New WebClient()
' Download the home page data.
Console.WriteLine(("Downloading " + remoteUrl))
' DownloadData() method takes a 'uriRemote.ToString()' and downloads the Web resource and saves it into a data buffer.
Dim myDatabuffer As Byte() = myWebClient.DownloadData(remoteUrl)

' Display the downloaded data.
Dim download As String = Encoding.ASCII.GetString(myDataBuffer)
Console.WriteLine(download)

Console.WriteLine("Download successful.")

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900