Capture http requests of the webbrowser in winform (C#)

In the development of a simple (um, it’s really not that simple actually) program for downloading and merging customized google map, I need to get the URL of the customized map tiles. The URL is generated in front-end, and it seems the JavaScript that generates the URL is encrypted. Then how can I get the URL? I cannot get it from the back end or from the front end by generating the URL myself. I also think the users will get confused if they are asked to find the tile URL themselves, by pressing F12 in Chrome, looking into the image resources and coping the URL there.

 

Therefore, the only way to get the URL automatically is to capture the Http request sent by the application. I thought this would be quite easy as the program would be running on the local disk, and would not need too much permission. It then proved to be much more difficult than I thought. After searching for a long time on Stackoverflow, trying different solutions on Codeproject, and using different third-party frameworks such as Wincap, SharpPcap or the famous FiddlerCore, I found none of them can be the solution: some of them will lost packages during the capture, some of them can only work on systems with IE version lower than 7.

 

However, when I was to give up, I found this amazing library–Netcut, which helps me realize what exactly I want: capture every http request sent from the webbrowser. Some demo codes can be downloaded here: https://wenfan.cn/idea/wp-content/uploads/2016/06/NetWatcher.rar

netcut

Hope this can help someone who has the same problems. The program that I developed for downloading and merging google map is here.