javascript – How to retrieve via C# the generated page HTML with AngularJS?


How to retrieve the HTML code of a page that uses AngularJS to process some information and generate a graph?
I was able to easily retrieve the HTML code using WebRequest as shown in the example below, but the (graphic) content generated by AngularJS does not come in the page code.

WebRequest request = WebRequest.Create("http://localhost:36789/minhaapp#/index");
WebResponse response = request.GetResponse();
Stream data = response.GetResponseStream();
string html = String.Empty;
using (StreamReader sr = new StreamReader(data))
    html = sr.ReadToEnd();


If you have permission to edit the site that generates the graph, you must extract the data from the graph via JavaScript and send it to the server, only the data, through an http request. It is not ideal to send html to the server to extract the data.

Scroll to Top