Skip to content

Commit b6ac82f

Browse files
author
Çağrı Kaan Yıldırım
authored
Update NavigateWithWebResourceRequest.md
Removed the using statement which forces the stream to go out of scope before we can read it.
1 parent ece1396 commit b6ac82f

1 file changed

Lines changed: 10 additions & 11 deletions

File tree

specs/NavigateWithWebResourceRequest.md

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,16 @@ We also propose adding a CreateWebResourceRequest API to [CoreWebView2Environmen
3535
UTF8Encoding utfEncoding = new UTF8Encoding();
3636
byte[] postData = utfEncoding.GetBytes("input=Hello");
3737
38-
using (MemoryStream postDataStream = new MemoryStream(postData.Length))
39-
{
40-
postDataStream.Write(postData, 0, postData.Length);
41-
CoreWebView2WebResourceRequest webResourceRequest =
42-
environment.CreateWebResourceRequest(
43-
"https://www.w3schools.com/action_page.php",
44-
"POST",
45-
postDataStream,
46-
"Content-Type: application/x-www-form-urlencoded");
47-
webView.CoreWebView2.NavigateWithWebResourceRequest(webResourceRequest);
48-
}
38+
MemoryStream postDataStream = new MemoryStream(postData.Length);
39+
postDataStream.Write(postData, 0, postData.Length);
40+
CoreWebView2WebResourceRequest webResourceRequest =
41+
environment.CreateWebResourceRequest(
42+
"https://www.w3schools.com/action_page.php",
43+
"POST",
44+
postDataStream,
45+
"Content-Type: application/x-www-form-urlencoded");
46+
webView.CoreWebView2.NavigateWithWebResourceRequest(webResourceRequest);
47+
4948
```
5049

5150
# Remarks

0 commit comments

Comments
 (0)