本文整理汇总了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
}
示例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")
{
//.........这里部分代码省略.........