如何清除WPF应用程序中的WebBrowser缓存?

问题描述:

我正在使用WebBrowser控件显示登录页面,以供用户登录其帐户,然后应用程序将从该帐户获取联系人。

I am using the WebBrowser control to display a Login page for user to signing to their account and then application will get contacts from that account.

但是,问题是,如果用户从浏览器中选择选项保持签名,浏览器将缓存该帐户名,并使用不同的帐户进行下一次登录,它将返回上一个已缓存的帐户名称。导致应用程序使用错误的帐户名。

However, the problem is if user select option "Keep signing" from browser, browser will cache that account name and next login with different account, it will return previous cached account name. This lead to application will get wrong account name.

你们知道如何强制WebBrowser在进行下一步操作之前清除所有缓存吗?

You guys know how to force WebBrowser to clear all cache before proceed to prevent this problem?

我认为WebBrowser使用的Internet Explorer是我计算机上的版本11。

I think WebBrowser use Internet Explorer, which is version 11 on my machine.

我解决了通过以下链接解决我的问题: http: //mdb-blog.blogspot.com/2013/02/c-winforms-webbrowser-clear-all-cookies.html

I solved my problem by follow this link: http://mdb-blog.blogspot.com/2013/02/c-winforms-webbrowser-clear-all-cookies.html