windows phone 7没有提供删除Cookie相关的API.
WebBrowser控件 cache住了上一次登录的网页信息了,
比如,我用人人网的SDK登录账户A,这时候不退出程序,logout想登录账户B,这时候发现再点击OAuth授权时,直接就显示登录成功,信息还是账户A的,没法登录账户B了
I can not handle it. should have used a procedure to complete its work. I logout URL navigate directly to the parser from the website. Code: private void btnlogout_Click(object sender, RoutedEventArgs e) { string logout = Showalltopic.logoutString; webBrowser11.Source = new Uri("http://mydomain.com/login.php?do=logout&logouthash="+logout); webBrowser11.LoadCompleted += new System.Windows.Navigation.LoadCompletedEventHandler(webBrowser11_LoadCompleted); btnlogin.Visibility = System.Windows.Visibility.Visible; btnlogout.Visibility = System.Windows.Visibility.Collapsed; } void webBrowser11_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e) { string content = webBrowser11.SaveToString(); if (content.Contains("All cookies cleared!")) { MessageBox.Show("Logout success"); webBrowser11.Navigate(new Uri("http://mydomain.com/", UriKind.Absolute)); } System.IO.IsolatedStorage.IsolatedStorageSettings _appSetting = System.IO.IsolatedStorage.IsolatedStorageSettings.ApplicationSettings; _appSetting.Clear(); _appSetting.Save(); } after logout, WP7 information is stored in isolateStoraged clear that we must be able to logout successfully. Hope everyone is no other way to clear the cookie in webbrowser.
试试,复制过来的
我也在学