Welcome Guest Search | Active Topics | Sign In | Register

How can I get response content? Options
Kobzar666
Posted: Tuesday, October 8, 2019 6:04:55 AM
Rank: Newbie
Groups: Member

Joined: 10/4/2019
Posts: 5
Hello, I'm using AfterReceiveHeadersEvent to get "application/json" response. I can get headers, contentType, statusCode etc. But how to get json content?
eo_support
Posted: Tuesday, October 8, 2019 10:04:48 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Hi,

You will not be able to get the response contents directly from the browser engine because for most pages the browser engine never has the full response contents. This is because the browser engine is highly optimized and it parses the contents chunk by chunk as it receives them. Once a chunk of the raw contents data is parsed, it is immediately discarded.

If you must intercept the response contents, you can use a custom resource handler to fetch the resource in your own code in entirety, then pass this entire response down to the browser engine. Obviously this would have a negative impact on performance since it would lose both the key optimization step mentioned above, but also other optimizations by the loader layer. However it would allow you to inspect/modify the response since your code would have the response before the browser engine can have it.

See here for more details on custom resource handler:

https://www.essentialobjects.com/doc/webbrowser/advanced/resource_handler.aspx

Hope this helps.

Thanks!
Kobzar666
Posted: Friday, October 18, 2019 7:23:26 PM
Rank: Newbie
Groups: Member

Joined: 10/4/2019
Posts: 5
Thanks. But I not realy understand how to use it. How can I get json response content? Can you make example?
eo_support
Posted: Friday, October 18, 2019 8:49:59 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
I am not sure if you understand our previous reply. With EO.WebBrowser there are two options:

1. Let the browser engine handle everything. With this option, you can NOT get the response content at all (as explained above);

2. You get the content yourself first, then pass it to the browser engine. With this option the browser engine takes over after you get your content. Exactly how you get your content is up to you and would no longer have anything to do with EO.WebBrowser at all.

As you can see, if you use option 2, you will need to get the contents yourself. With this option the browser engine only display the contents for you (as oppose to option 1 it would both fetch and display the content for you).

In short, you can NOT get the contents through EO.WebBrowser.

Hope this clear it up for you.
sexfio1
Posted: Monday, October 21, 2019 3:25:34 AM
Rank: Member
Groups: Member

Joined: 10/17/2019
Posts: 14
gethtml ???
eo_support
Posted: Monday, October 21, 2019 10:43:26 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
GetHTML does not get your response content. It gets the current HTML of the DOM tree. These two are very different. For example, your response content can be a small piece of JavaScript code that dynamically creates a lot of HTML content. In that case the response content is your JavaScript code but GetHtml will return you the result HTML created by the JavaScript code.
Kobzar666
Posted: Thursday, October 31, 2019 9:44:49 AM
Rank: Newbie
Groups: Member

Joined: 10/4/2019
Posts: 5
So there is no way to get response content from loaded page with your WebBrowser? In DotNetBrowser there is simple way to do it.
https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000110177-accessing-http-response-data
eo_support
Posted: Thursday, October 31, 2019 10:51:43 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,067
Hi,

No. We do not provide this feature because it does not give you the full response --- the delegate can be called multiple times and each time only with a chunk of data.

Thanks!
sexfio1
Posted: Sunday, November 3, 2019 9:17:46 PM
Rank: Member
Groups: Member

Joined: 10/17/2019
Posts: 14
Kobzar666 wrote:
So there is no way to get response content from loaded page with your WebBrowser? In DotNetBrowser there is simple way to do it.
https://dotnetbrowser.support.teamdev.com/support/solutions/articles/9000110177-accessing-http-response-data



Can Dotnetbrowser get the http-only cookie and set the new cookie in webbrowser ???
in EO if you want to get the responsebody, It looks like you can only use fiddlerapi



You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.