Welcome Guest Search | Active Topics | Sign In | Register

How to get server response data Options
m13
Posted: Tuesday, April 18, 2017 9:47:15 PM
Rank: Newbie
Groups: Member

Joined: 4/18/2017
Posts: 5
private void webView1_AfterReceiveHeaders(object sender, EO.WebBrowser.ResponseEventArgs e)
{

MemoryStream ms= (MemoryStream)e.Response.OutputStream;//this line is wrong message “OutputStream is not available during this context”
}

How to get the server to return data ?How to write?
eo_support
Posted: Wednesday, April 19, 2017 8:20:19 AM
Rank: Administration
Groups: Administration

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

You will not be able to get the server's response. AfterReceiveHeaders occurs exactly as the name suggest ---- it occurs after the header has been received and BEFORE the BODY of the response has been received.

There is no way for you to intercept the server's response with EO.WebBrowser. The server's response goes straight to the parser. You can not monitor/alter it in any way unless you use a custom resource handler to load the resource yourself.

Thanks!
m13
Posted: Wednesday, April 19, 2017 1:30:27 PM
Rank: Newbie
Groups: Member

Joined: 4/18/2017
Posts: 5
eo_support wrote:
Hi,

You will not be able to get the server's response. AfterReceiveHeaders occurs exactly as the name suggest ---- it occurs after the header has been received and BEFORE the BODY of the response has been received.

There is no way for you to intercept the server's response with EO.WebBrowser. The server's response goes straight to the parser. You can not monitor/alter it in any way unless you use a custom resource handler to load the resource yourself.

Thanks!


Hi,
Thank you for your answer

I hope there will be an interface to retrieve the data from the service, which is more conducive to developers to do what they want to do, but that is just my idea
eo_support
Posted: Wednesday, April 19, 2017 2:20:55 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
This is unlikely to be implemented due to the performance implication on this. The browser engine is highly optimized both in term of speed and memory consumption. Because of this, the browser engine never keeps the whole response document. It receives a segment from the server, parse it, keeps the parsed result and discard the original data. Even if we redirect the data through your code, you will still be seeing a small segment at any given time, which would usually be useless unless you accumulate all the data until you receive the whole document. This in turn would block the browser's parsing engine and can have serious performance consequence. So it is not a good idea to do this. If you must intercept the data, you can use your custom resource handler, or implement your own proxy server and do it in your proxy server.
m13
Posted: Wednesday, April 19, 2017 10:20:42 PM
Rank: Newbie
Groups: Member

Joined: 4/18/2017
Posts: 5
eo_support wrote:
This is unlikely to be implemented due to the performance implication on this. The browser engine is highly optimized both in term of speed and memory consumption. Because of this, the browser engine never keeps the whole response document. It receives a segment from the server, parse it, keeps the parsed result and discard the original data. Even if we redirect the data through your code, you will still be seeing a small segment at any given time, which would usually be useless unless you accumulate all the data until you receive the whole document. This in turn would block the browser's parsing engine and can have serious performance consequence. So it is not a good idea to do this. If you must intercept the data, you can use your custom resource handler, or implement your own proxy server and do it in your proxy server.

May let the customer choose whether to save data (default no save), just save the server received the last received data, like "falsh game and server communication data (not including JS code, HTML simple string data)
eo_support
Posted: Thursday, April 20, 2017 9:03:52 AM
Rank: Administration
Groups: Administration

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

If you only want to get the response data, you can just use the download feature instead. See here for more details:

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

We are also adding a WebView.Download method in our next build and it should make it easier for you to just download a Url.

Thanks
m13
Posted: Thursday, April 20, 2017 10:14:30 PM
Rank: Newbie
Groups: Member

Joined: 4/18/2017
Posts: 5
eo_support wrote:
Hi,

If you only want to get the response data, you can just use the download feature instead. See here for more details:

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

We are also adding a WebView.Download method in our next build and it should make it easier for you to just download a Url.

Thanks

Thanks


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.