Compartir a través de


CredentialInfoEventArgs Clase

Definición

Proporciona datos para un controlador de eventos con respecto a la adquisición de credenciales.

public ref class CredentialInfoEventArgs sealed : System::ComponentModel::CancelEventArgs
public sealed class CredentialInfoEventArgs : System.ComponentModel.CancelEventArgs
type CredentialInfoEventArgs = class
    inherit CancelEventArgs
Public NotInheritable Class CredentialInfoEventArgs
Inherits CancelEventArgs
Herencia
CredentialInfoEventArgs

Ejemplos

En el ejemplo siguiente se autentica el nombre de usuario y la contraseña.

void EditFeature(object sender, CredentialInfoEventArgs e) {
    try {
        e.Cancel = true;

        using (new rWait()) {
            string userName = String.Empty;
            if (!String.IsNullOrEmpty(e.Credentials.UserName)) {
                userName = e.Credentials.UserName;
            }

            string password = String.Empty;
            if (!String.IsNullOrEmpty(e.Credentials.Password)) {
                // If no username is set, but a password is, show an error
                if (String.IsNullOrEmpty(userName)) {
                    IManagementUIService uiService =
                        (IManagementUIService)GetService(typeof(IManagementUIService));
                    Debug.Assert(uiService != null, "Couldn't get IManagementUIService.");

                    uiService.ShowError(null, "Invalid User Name",
                       "Authentication Failed", false);

                    return;
                }

                password = e.Credentials.Password;
            }

            _serviceProxy.SetAnonAuthen(userName, password);

            e.Cancel = false;
            _userName = userName;
            _password = password;
        }
    } catch (Exception ex) {
        MessageBox.Show(ex.Message, "EditFeature");
    }
} 

Comentarios

Use esta clase para cancelar eventos que requieren un CredentialInfo objeto .

Constructores

CredentialInfoEventArgs(CredentialInfo)

Inicializa una nueva instancia de la clase CredentialInfoEventArgs.

Propiedades

Credentials

Obtiene la información de credenciales que se pasa al CredentialInfoEventArgs(CredentialInfo) constructor.

Se aplica a