Click here to Skip to main content
15,892,298 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need to download all the url saved on my Database , I got a code that retrive all the url list from the database , and i also got a code that download the actual page , now i need a code that gona take all this url list download all this pages within a loop this is my code i have that download the string of the pages


C#
string url = "http://www.urlfilterdb.com/files/downloads/ReferenceManual.pdf";
            string strResult = "";
         

            WebResponse objResponse;
            WebRequest objRequest = System.Net.HttpWebRequest.Create(url);

            objResponse = objRequest.GetResponse();



            using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
            {
                strResult = sr.ReadToEnd();
           
                // Close and clean up the StreamReader
                sr.Close();
            }

            // Display results to a webspage
            Response.Write(strResult);
            // save to the databa
            System.IO.File.WriteAllText(@"C:\Users\Nokukhanya\Documents\pages_index\", strResult);
Posted
Updated 25-Jul-12 4:01am
v2
Comments
[no name] 25-Jul-12 10:06am    
Are you asking how to write a for loop?
Sandeep Mewara 25-Jul-12 10:39am    
Sounds like that only!

1 solution

You need to use regex to parse the URLs if htat's what you want. I don't see a clear question here. Did you write this code, or did you find it and now you want us to make it work for you ?
 
Share this answer
 

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