In this post we will see how to set values in the header and the cookie of your WebView in a UWP application.
First we need a method to create a new WebView:
To edit the HTTP header that will be called by the WebView, and because we are using HttpRequestMessage from the Windows.Web.Http namespace. We will edit the header like we would normally by creating a HttpRequestMessage property and adding a header by using Headers.Add:
Next here is how we can set cookies for our WebView, make sur that for the HttpCookie(key, ".YourDomain.com", "/") you set the correct domain or it will not work. Make sur that you set all the value correct (if the cookie is for a third party then make sure that SetCookie is set to TRUE and not false).
And lastly is how you could for example use all of these methods together.