Class WindowsCredentials
Provides an interface to the Windows Credentials API. Supported on Windows XP or newer.
public static class WindowsCredentials
- Inheritance
-
objectWindowsCredentials
Methods
IsCredentialStored(string)
Determines whether there are any credentials stored for a specific target.
public static bool IsCredentialStored(string target)
Parameters
targetstringA string uniquely identifying the target the credentials are intended for.
Returns
- bool
Exceptions
- PlatformNotSupportedException
The current platform does not support the Credentials API. Needs Windows XP or newer.
PromptCli(string, WindowsCredentialsFlags)
Prompts the user for credentials using a command-line interface.
public static NetworkCredential PromptCli(string target, WindowsCredentialsFlags flags)
Parameters
targetstringA string uniquely identifying the target the credentials are intended for.
flagsWindowsCredentialsFlagsFlags for configuring the prompt.
Returns
- NetworkCredential
Exceptions
- PlatformNotSupportedException
The current platform does not support the Credentials API. Needs Windows XP or newer.
PromptGui(string, WindowsCredentialsFlags, string?, string?, IntPtr)
Prompts the user for credentials using a GUI dialog.
public static NetworkCredential PromptGui(string target, WindowsCredentialsFlags flags, string? title = null, string? message = null, IntPtr owner = default)
Parameters
targetstringA string uniquely identifying the target the credentials are intended for.
flagsWindowsCredentialsFlagsFlags for configuring the prompt.
titlestringThe title of the dialog.
messagestringThe message to display in the dialog.
ownerIntPtrThe parent window for the dialog; can be
null.
Returns
- NetworkCredential
Exceptions
- PlatformNotSupportedException
The current platform does not support the Credentials API. Needs Windows XP or newer.