当前位置: 首页>>代码示例>>C#>>正文


C# WebBrowser.ClearCookiesAsync方法代码示例

本文整理汇总了C#中WebBrowser.ClearCookiesAsync方法的典型用法代码示例。如果您正苦于以下问题:C# WebBrowser.ClearCookiesAsync方法的具体用法?C# WebBrowser.ClearCookiesAsync怎么用?C# WebBrowser.ClearCookiesAsync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WebBrowser的用法示例。


在下文中一共展示了WebBrowser.ClearCookiesAsync方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClearCookies

        public static void ClearCookies()
        {
#if SILVERLIGHT

            var webBrowser = new WebBrowser();

            webBrowser.ClearCookiesAsync();

#else

            Windows.Web.Http.Filters.HttpBaseProtocolFilter myFilter = new Windows.Web.Http.Filters.HttpBaseProtocolFilter();
            var cookieManager = myFilter.CookieManager;
            HttpCookieCollection myCookieJar = cookieManager.GetCookies(new Uri("https://vk.com"));
            foreach (HttpCookie cookie in myCookieJar)
            {
                cookieManager.DeleteCookie(cookie);
            }

            myCookieJar = cookieManager.GetCookies(new Uri("https://login.vk.com"));
            foreach (HttpCookie cookie in myCookieJar)
            {
                cookieManager.DeleteCookie(cookie);
            }
#endif
        }
开发者ID:super-ala,项目名称:vk-windowsphone-sdk,代码行数:25,代码来源:VKUtil.cs

示例2: csWork

        public bool csWork(String action, String actionData)
        {
            if (action == "CCWebView::openPage")
            {
                if (m_webView == null)
                {
                    m_webView = new WebBrowser();
                    m_webView.IsScriptEnabled = true;

                    if (m_webViewClearCookies)
                    {
                        m_webViewClearCookies = false;
                        m_webView.ClearCookiesAsync();
                    }

                    m_webView.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(webBrowser_WebView_LoadCompleted);
                    m_webView.Navigating += new EventHandler<NavigatingEventArgs>(webBrowser_Navigating);
                    m_webView.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(webBrowser_WebView_NavigationFailed);
                    m_webView.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(webBrowser_Navigated);

                    MainPage.m_mainPage.LayoutRoot.Children.Add(m_webView);
                }

                String url = actionData;
                m_webView.Navigate(new Uri(url));

                return true;
            }
            else if (action == "CCWebView::close")
            {
                if (m_webView != null)
                {
                    MainPage.m_mainPage.LayoutRoot.Children.Remove(m_webView);
                    m_webView = null;
                    MainPage.m_d3dInterop.csActionResult("CCWebView::closed", "");
                }

                return true;
            }
            else if (action == "CCWebView::clearData")
            {
                if (m_webView != null)
                {
                    m_webView.ClearCookiesAsync();
                }
                else
                {
                    m_webViewClearCookies = true;
                }
                MainPage.m_d3dInterop.csActionResult("CCWebView::clearedData", "");

                return true;
            }

            else if (action == "CCWebJS::openPage" || action == "CCWebJS::openFile")
            {
                if (m_webJS == null)
                {
                    m_webJS = new WebBrowser();
                    //m_webJS.ClearInternetCacheAsync();
                    m_webJS.IsScriptEnabled = true;

                    m_webJS.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(webBrowser_WebJS_LoadCompleted);
                    m_webJS.Navigating += new EventHandler<NavigatingEventArgs>(webBrowser_Navigating);
                    m_webJS.NavigationFailed += new System.Windows.Navigation.NavigationFailedEventHandler(webBrowser_WebJS_NavigationFailed);
                    m_webJS.Navigated += new EventHandler<System.Windows.Navigation.NavigationEventArgs>(webBrowser_Navigated);
                }

                loadingWebJS = true;

                if (action == "CCWebJS::openPage")
                {
                    String url = actionData;
                    Uri uri = new Uri(url);
                    m_webJS.Navigate(uri);
                }
                else
                {
                    //String filePath = actionData;
                    //using (StreamReader reader = new StreamReader(filePath))
                    //{
                    //    m_webJS.NavigateToString(reader.ReadToEnd());
                    //}
                    webBrowser_WebJS_OpenFile(actionData);
                }

                return true;
            }
            else if (action == "CCWebJS::close")
            {
                if (m_webJS != null)
                {
                    m_webJS = null;
                    MainPage.m_d3dInterop.csActionResult("CCWebJS::closed", "");
                }

                return true;
            }
            else if (action == "CCAppManager::WebBrowserOpen")
            {
//.........这里部分代码省略.........
开发者ID:kariem2k,项目名称:playir,代码行数:101,代码来源:CSWeb.cs


注:本文中的WebBrowser.ClearCookiesAsync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。