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
target
stringA 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
target
stringA string uniquely identifying the target the credentials are intended for.
flags
WindowsCredentialsFlagsFlags 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
target
stringA string uniquely identifying the target the credentials are intended for.
flags
WindowsCredentialsFlagsFlags for configuring the prompt.
title
stringThe title of the dialog.
message
stringThe message to display in the dialog.
owner
IntPtrThe 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.