nitin yadav

nitin yadav

  • NA
  • 136
  • 0

How to get HTML of the web page not view source in asp.net

Oct 17 2012 4:26 AM
Hi,

I want to get html of the web page and i am using this code: 

const string _strUserAgent = "Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4";
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://localhost:4707/Report/ShowCharts?ClientReportID=242&schduleID=22,5,,3,3");
            request.UserAgent = _strUserAgent;
            request.Method = "POST";
            request.ReadWriteTimeout = 100000;
            //request.Proxy = proxy;
            StreamReader stream = new StreamReader(request.GetResponse().GetResponseStream());
            StringBuilder sb = new StringBuilder();
            string strLine;
            while ((strLine = stream.ReadLine()) != null)
            {
                if (strLine.Length > 0)
                    sb.Append(strLine);
            }
            stream.Close();
            string result = sb.ToString();

But this above code returning view source of the page not the html of the page. Like on this url that i mentioned above(http://localhost:4707/Report/ShowCharts?ClientReportID=242&schduleID=22,5,,3,3), we are creating telerik charts. So i need to grab all html including this charts also. Thanks

Regards
Nitin Yadav