Welcome Guest Search | Active Topics | Sign In | Register

Custom Resource Handler cannot find PostData for XMLHttpRequest POST Options
David Robinson
Posted: Friday, May 17, 2019 5:21:51 PM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2015
Posts: 33
We have JavaScript running inside WebView and a Custom Resource Handler. The JavaScript uses XMLHttpRequest to send a POST with some some JSON.
Code: JavaScript
var Request = new windows.XMLHttpRequest();
Request.open("POST", network.Url, true);
Request.setRequestHeader("Content-type", "application/json");
Request.onreadystatechange = connectHandler;
Request.send(jsonStr);

In an IHttpHandler.ProcessRequest, we can read the POST data using:
Code: Visual Basic.NET
Request.BinaryRead(Request.TotalBytes)

and we then send back a JSON response.

The WebView Custom Resource Handler receives the Request and finds that the Method is POST, but the Request.PostData is empty and the ContentLength is zero.

In a pinch we could exchange JSON using an JSExtInvokeHandler, but I would think that the POST should have worked.

BTW, the Custom Resource Handler is cool. All the GET requests come through and we send back everything to make the app happy.
Thanks,
David
David Robinson
Posted: Friday, May 17, 2019 5:24:25 PM
Rank: Advanced Member
Groups: Member

Joined: 4/6/2015
Posts: 33
We are running EO.WebBrowser 19.1.40.0 in WinForms.
eo_support
Posted: Tuesday, May 21, 2019 11:21:08 AM
Rank: Administration
Groups: Administration

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

We tested this with the latest build and it appears to be working correctly. Can you send us a test project that demonstrates the problem? See here for more information on how to send test project to us:

https://www.essentialobjects.com/forum/test_project.aspx

Thanks!
eo_support
Posted: Wednesday, May 22, 2019 8:18:41 AM
Rank: Administration
Groups: Administration

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

We have received and looked into your test project. The root of the problem is you are using a file Url. You can not do HTTP POST with file Url because HTTP POST is a part of HTTP protocol, so the whole HTTP conversation would not occur when you load a file Url. As such no post data are retained. Please use HTTP protocol instead (you can use custom resource handler to serve the main contents from your file) and it should work.

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.