







Prompts the user for credentials. This class cannot be inherited.
Namespace: DotRas
Assembly: DotRas (in DotRas.dll) Version: 1.3.5166.33435 (1.3.0.0)
Syntax
C# |
---|
public sealed class CredentialPromptDialog : CommonDialog |
Visual Basic |
---|
Public NotInheritable Class CredentialPromptDialog Inherits CommonDialog |
Visual C++ |
---|
public ref class CredentialPromptDialog sealed : public CommonDialog |
F# |
---|
[<SealedAttribute>] type CredentialPromptDialog = class inherit CommonDialog end |
Remarks
The TargetName property should contain the name of the server or machine for which credentials are being requested. This dialog also ties into the Windows credential store to pre-populate the user name if the stored credentials are found.
This class uses the Network Access: Do not allow storage of credentials or .NET passports for network authentication policy setting. If this policy is enabled, the dialog will not be able to persist credentials.
Known Limitations:
- This component is only available on Windows XP and later operating systems.
Examples
The following example shows how to request credentials from the user.
C# | ![]() |
---|---|
using (CredentialPromptDialog dialog = new CredentialPromptDialog()) { dialog.TargetName = "ServerName"; if (dialog.ShowDialog() == DialogResult.OK) { // The UserName and Password properties will contain the result. } } |
Visual Basic | ![]() |
---|---|
Dim dialog As CredentialPromptDialog Try dialog = New CredentialPromptDialog() dialog.TargetName = "ServerName" If dialog.ShowDialog() = DialogResult.OK Then ' The UserName and Password properties will contain the result. End If Finally If dialog IsNot Nothing Then dialog.Dispose() End If End Try |
Inheritance Hierarchy
System..::..Object
System..::..MarshalByRefObject
System.ComponentModel..::..Component
System.Windows.Forms..::..CommonDialog
DotRas..::..CredentialPromptDialog
System..::..MarshalByRefObject
System.ComponentModel..::..Component
System.Windows.Forms..::..CommonDialog
DotRas..::..CredentialPromptDialog