Search code examples
c#credentials

How to remove Windows credentials


Using the following command, all stored Windows credentials will be shown.

rundll32.exe keymgr.dll,KRShowKeyMgr

I'm looking for a way to remove a single credential, e.g. credentials to a special server.

The C# Windows application shall remove the credential. I was looking into the namespaces System.Web.Security and System.ServiceModel.Security, but that seems not to fit.

I guess there should be a managed Windows API that can do the job.

How can I do this?


Solution

  • Try this NuGet package: https://www.nuget.org/packages/CredentialManagement/. It can get, set, and remove Windows credentials.

    Actually, there isn't any official C# API. This NuGet package just wraps the necessary DLL file calls.