|
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?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
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!
|
|
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
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
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.
|
|
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)
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,229
|
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.aspxWe 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
|
|
Rank: Newbie Groups: Member
Joined: 4/18/2017 Posts: 5
|
|
|