I am developing a WPF desktop application that will only allow 3 metro apps to be used by any user i.e. FB, Skype, Viber. As soon as user End His Session via my application I have to remove the credentials used by the user to login to these apps. I found that these metro apps store there credentials related info in "Web Credentials" portion of Credential Manager. I want to remove these enteries programmatically using C# so that when any other user opens the metro application via my application he sees the login screen.
Remove any entry from web credentials portion of credential manager programmatically
2.8k views Asked by Mustehsan Ikram At
3
There are 3 answers
0
On
Try this code :
NetworkCredential networkCredential = new NetworkCredential("username", "password");
WebRequest webRequest = HttpWebRequest.Create("http://www.contoso.com/");
webRequest.Credentials = networkCredential;
CredentialCache credentialCache = new CredentialCache();
credentialCache.Add(new Uri("http://www.contoso.com/"), "Basic", networkCredential);
webRequest.Credentials = credentialCache;
credentialCache.Remove(webRequest.RequestUri, "Basic");
I would want to tell the method that i used to clear web credentials.
Note: For Point 2, application must run in specific user privilege because each user has his own profile.