ArcObjects Library Reference (Framework)  

IGetUserAndPasswordDialog Interface

Provides access to members that work with a dialog for getting user and password information.

Product Availability

Available with ArcGIS Desktop.

Members

Description
Method DoModal Shows the dialog.
Read-only property Password The password entered in the dialog.
Read-only property UserName The user name entered in the dialog.

CoClasses that implement IGetUserAndPasswordDialog

CoClasses and Classes Description
GetUserAndPasswordDialog A dialog used for getting user and password information.

Remarks

The get user and password dialog is a dialog used for getting username and password information.

To get access to the IGetUserAndPasswordDialog interface, create a new GetUserAndPasswordDialog object.

The following code shows a GetUserAndPassword dialog and validates the username and password that was entered in the dialog. You would get m_app from the hook in ICommand::OnCreate().

[C#]

IGetUserAndPasswordDialog pDlg = new GetUserAndPasswordDialogClass();
bool bOK = pDlg.DoModal("Login", "Login for this document:", m_app.hWnd);
if (bOK)
{
  if (pDlg.UserName == "GISTeam" && pDlg.Password == "guru")
    System.Windows.Forms.MessageBox.Show("You're in!");
  else
    System.Windows.Forms.MessageBox.Show("Wrong user name or password");
}
else
  System.Windows.Forms.MessageBox.Show("Cancelled");

[Visual Basic .NET]
Dim pDlg As IGetUserAndPasswordDialog = New GetUserAndPasswordDialogClass()
Dim bOK As Boolean = pDlg.DoModal("Login", "Login for this document:", m_app.hWnd)
If bOK Then
 If pDlg.UserName = "GISTeam" AndAlso pDlg.Password = "guru" Then
  System.Windows.Forms.MessageBox.Show("You're in!")
 Else
  System.Windows.Forms.MessageBox.Show("Wrong user name or password")
 End If
Else
 System.Windows.Forms.MessageBox.Show("Cancelled")
End If