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.
Asked
Active
Viewed 2,834 times
3 Answers
0
I would want to tell the method that i used to clear web credentials.
- Stop Credential Manager Service from application running with admin privileges.
- Delete all files with extensions .vcrd and .vsch in local users's Local\Microsoft\Vault.
- Start Credential Manager Service.
Note: For Point 2, application must run in specific user privilege because each user has his own profile.

Kiquenet
- 14,494
- 35
- 148
- 243

Mustehsan Ikram
- 218
- 2
- 4
- 15
-1
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");

Abdallah Shakhatreh
- 760
- 12
- 23