AFPromptForCredential.SaveCredential Method
- Last UpdatedNov 18, 2025
- 2 minute read
- PI System
- AF SDK 2024 R2
- Developer
Save a credential into the Windows Credential Manager.
Namespace: OSIsoft.AF.UI
Assembly: OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 3.1.1.1182
Syntax
public static void SaveCredential( string target, string userName, SecureString password )
Public Shared Sub SaveCredential ( target As String, userName As String, password As SecureString ) Dim target As String Dim userName As String Dim password As SecureString AFPromptForCredential.SaveCredential(target, userName, password)
public: static void SaveCredential( String^ target, String^ userName, SecureString^ password )
static member SaveCredential : target : string * userName : string * password : SecureString -> unit
Parameters
- target
- Type: SystemString
The target for the credential in the Windows Credential Manager. - userName
- Type: SystemString
The user name for the credential to be saved in the Windows Credential Manager. - password
- Type: System.SecuritySecureString
The password for the credential to be saved in the Windows Credential Manager.
Remarks
This method is used to save a credential into the Windows Credential Manager for the specified target. If a credential is already present for the target, it is overwritten. This method is automatically called when using one of the ShowDialog Overload methods and the RememberCredential property is after the dialog is closed.
If not using one of the ShowDialog Overload methods, then this method should be called to save the credential to the Windows Credential Manger.