2

I'm using Awesomium to embed a web page in a windows application. I'm trying to hook into the GET from our REST api so that when the page requests data I can access the JSON response in my C# code.

I've tried hooking into WebControl.TargetURLChanged to no avail. I've also tried hooking into that same event on the active WebSession.View.

Is there a way, with Awesomium or otherwise, to capture HTTP GETs made from a hosted web page and access the response data?

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
JoeB
  • 2,743
  • 6
  • 38
  • 51
  • You could look into the Fiddle api. http://fiddler2.com/fiddlercore – Ash Burlaczenko Oct 22 '13 at 15:29
  • Yeah, that's a decent suggestion and one I was considering myself. I'd rather see if it's possible with the tech I'm using already first. – JoeB Oct 22 '13 at 17:03
  • What about using javascript integration http://wiki.awesomium.com/general-use/introduction-to-javascript-integration.html – Papasmile Oct 22 '13 at 20:28
  • @Papasmile - that looks promising! Of course that type isn't documented on the .NET side of the wiki, only the C++ side. I'll give it a shot and if it works I'll let you know so you can move your comment to an answer. – JoeB Oct 22 '13 at 21:31
  • @Papasmile, I've been unable to get the actual object using JSValue. The .NET version doesn't have a ToObject method, and the ToString just returns the type (e.g., "{object}" for "window). – JoeB Oct 23 '13 at 19:39
  • Sorry you are having a tough time... try function callbacks (passing your return in a another javascript function) to return a string whatever you want. – Papasmile Oct 23 '13 at 19:55
  • Also check out on SO http://stackoverflow.com/questions/13280727/can-i-call-application-methods-from-javascript-in-awesomium/13382677#13382677 – Papasmile Oct 23 '13 at 19:57
  • Wow, can't believe I missed that other question. I was able to get the sample on that question working, and I think when I combine that with the ResourceInterceptor I can get the functionality I want. Create an answer like "use function callbacks like show in this link" as an answer and I'll give you the internet points. Thanks! – JoeB Oct 23 '13 at 21:59

0 Answers0