Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to send correct post data when navigation? #1238

Closed
xiedongweo opened this issue Apr 30, 2021 · 2 comments
Closed

How to send correct post data when navigation? #1238

xiedongweo opened this issue Apr 30, 2021 · 2 comments
Assignees

Comments

@xiedongweo
Copy link

xiedongweo commented Apr 30, 2021

We are using the following code to navigate to the specific page with the form data. But our backend cannot get the correct form data. It always is null.

Please help me check if there are some issues in my code.

`
string formData ="&name=abc&age=10";
byte[] pramByte = Encoding.ASCII.GetBytes(formData);
using(Stream stream = new MemoryStream(pramByte))
{
CoreWebView2WebResourceRequest request =
this.browser.CoreWebView2.Environment.CreateWebResourceRequest("http://localhost:8080/test", "POST", stream, "Content-
Type: application/x-www-form-urlencoded");

this.browser.CoreWebView2.NavigateWithWebResourceRequest(request);

}
`

@yildirimcagri-msft
Copy link
Member

yildirimcagri-msft commented Feb 24, 2022

Sorry, this question got lost in our backlog for a while :( ... We had fixed some bugs around this code, please let me know if you still need help with this. Also, if this is a UWP app, I'd recommend using InMemoryRandomAccessStream instead of MemoryStream as the WinRT MemoryStream has a known issue.

@lamposu
Copy link

lamposu commented Jun 6, 2022

This still have problem in WPF. I found that the MemoryStream if not use the "using" keyword, it works fine....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants