简体   繁体   中英

Get Developer Mode Source Code (F12) of a Web Page using C# (Dynamic Source of a web)

I'm trying to get the source code of a web page using C#,I get the base source code but most of the data is dynamically generated after. How can obtain the final source code filled with data? (Same Like Developer Option in Google Chrome & IE)

One way would be to wait for the page to load completely and call your c# functionality asynchronus afterwards.

JQuery

$(document).ready(function () { $.ajax("example.cs/MyWebMethod");});

And in c# you got something like

[System.Web.Services.WebMethod()]
public void MyWebMethod() { 
//..do stuff
}

If the ready event is also "too early" you could just set a timeout in jscript and call the WebMethod after a set timeperiod

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM