Xamarin.forms 如何在';中清除有关我的客户端凭据的所有缓存;注销';功能
我用xamarin表单制作了一个应用程序,提供登录/注销功能。 这些步骤在UWP中正常工作:Xamarin.forms 如何在';中清除有关我的客户端凭据的所有缓存;注销';功能,xamarin.forms,Xamarin.forms,我用xamarin表单制作了一个应用程序,提供登录/注销功能。 这些步骤在UWP中正常工作: 用户启动应用程序 用户输入正确的凭证并登录(此处错误的凭证始终不起作用,这是正常的) 用户单击注销 用户输入了错误的凭据,无法登录 不幸的是,在Android的第三步中,用户仍然可以登录 我已经尝试在客户端上使用类似Abort()Close()Dispose()的函数。不管怎样,在为我的客户创建新对象并放入错误的凭证后,一切仍然正常 这是我登录时做的 BasicHttpBinding binding =
BasicHttpBinding binding = new BasicHttpBinding();
binding.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;
binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows; // (I can use here NTLM and basic, result is the same)
MyClient myClient = new MyClient(binding, new EndpointAddress(myUrl));
myClient.ClientCredentials.Windows.ClientCredential.UserName = username
myClient.ClientCredentials.Windows.ClientCredential.Password = password;
myClient.ClientCredentials.UserName.UserName = username;
myClient.ClientCredentials.UserName.Password = password;
// this I've tried after logout and idk what I can do more
myClient.InnerChannel.Abort();
myClient.InnerChannel.Close();
myClient.InnerChannel.Dispose();
myClient.Abort();
myClient.Close();
myClient = null;
// Edit
// I used Android.Webkit.CookieManager on Android when logout in this way:
var cookieManager = CookieManager.Instance;
cookieManager.RemoveAllCookie();
cookieManager.RemoveSessionCookie();
cookieManager.RemoveExpiredCookie();
cookieManager.Flush();
// but still the same problem, I'm using Android 8.1 so I don't need CookieSyncManager.Instance.Sync(), because it's deprecated since api 21
我希望该应用程序可以防止在Android系统中注销后使用错误的凭证。目前只有UWP成功地提供了该功能。您可以查看此链接,它应该对您有所帮助:如果需要,您可以与simple server config共享一个基本的简单演示,以演示问题吗?请随意删除任何敏感代码或数据。