Example #1
0
        async void GetCookiesCmdExecuted(object target, ExecutedRoutedEventArgs e)
        {
            List <CoreWebView2Cookie> cookieList = await webView.CoreWebView2.CookieManager.GetCookiesAsync("https://www.bing.com");

            StringBuilder cookieResult = new StringBuilder(cookieList.Count + " cookie(s) received from https://www.bing.com\n");

            for (int i = 0; i < cookieList.Count; ++i)
            {
                CoreWebView2Cookie cookie = webView.CoreWebView2.CookieManager.CreateCookieWithSystemNetCookie(cookieList[i].ToSystemNetCookie());
                cookieResult.Append($"\n{cookie.Name} {cookie.Value} {(cookie.IsSession ? "[session cookie]" : cookie.Expires.ToString("G"))}");
            }
            MessageBox.Show(this, cookieResult.ToString(), "GetCookiesAsync");
        }
Example #2
0
        private void FoundCookies(CoreWebView2Cookie nppCookie, CoreWebView2Cookie a2skCookie)
        {
            string nppString  = nppCookie.Value;
            string a2skString = a2skCookie.Value;

            string mode         = this.StartModes[(StartMode)this.ModeToolStripComboBox.SelectedItem];
            string architecture = this.StartArchitectures[(Architecture)this.ArchitectureToolStripComboBox.SelectedItem];
            string locale       = Arguments.StartLocale;
            string launchUri    = String.Format(UrlFormat, Arguments.GameId, nppString, a2skString, mode, locale, architecture);
            string escapedUri   = Uri.EscapeUriString(launchUri);

            this.CloseApp(escapedUri);
        }
Example #3
0
        void AddOrUpdateCookieCmdExecuted(object target, ExecutedRoutedEventArgs e)
        {
            CoreWebView2Cookie cookie = webView.CoreWebView2.CookieManager.CreateCookie("CookieName", "CookieValue", ".bing.com", "/");

            webView.CoreWebView2.CookieManager.AddOrUpdateCookie(cookie);
        }