Balaji Palani

Balaji Palani

  • NA
  • 364
  • 63.6k

How to download a complete web page source code

Jun 16 2016 5:03 AM
Hi,
 
I need to download a complete html Source code below url.
 

 

 

http://bireports.education.ohio.gov/Microstrategy/asp/Main.aspx?evt=2048001&hiddensections=header%2Cpath%2CdockTop%2CdockLeft%2CdockBottom%2Cfooter%2Clinks&visMode=0&documentID=8259143A4C918098E4DAE397F7B89CDD&elementsPromptAnswers=50C135904A900677342F92A91D6A8612%3B50C135904A900677342F92A91D6A8612%3A047241&Server=EDUMSTRISP02&Port=0&Project=ReportCard&

 
 
 
 
I tried below code:
  1.   
    using (WebClient client = new WebClient()) // WebClient class inherits IDisposable
    {
    client.DownloadFile(url, @"F:\localfile.html");
    // Or you can get the file content without saving it:
    string htmlCode = client.DownloadString(url);
    //...
    }
 after downloaded page look like:
 
 Not able to get the web page content 
 

Answers (2)