I want to set cookies for my webview
via the code. I know it was not possible in windows phone. But is it now possible in windows 8? Can anyone guide me?
In Windows 8.1 and Windows 10 you can do:
// using Windows.Web.Http;
// using Windows.Web.Http.Filters;
Uri uri = new Uri("http://kiewic.com/your/url/");
HttpCookie cookie = new HttpCookie("fooName", uri.Host, "/");
cookie.Value = "barValue";
HttpBaseProtocolFilter filter = new HttpBaseProtocolFilter();
HttpCookieManager cookieManager = filter.CookieManager;
cookieManager.SetCookie(cookie, false);
MyWebView.Navigate(uri);
Sorry but the WebView control won't do that for you.
You can acomplish what you want creating a custom WebRequest with the desired headers, and then call WebView.NavigateToString() with the content of the WebResponse.