Share via


ICredentialBuilder.SpecifyCredentials Method

Definition

Displays a dialog box to gather credential information.

Overloads

SpecifyCredentials(IServiceProvider, String, String, String, Boolean, Boolean, String, String, String)

Displays a dialog box to gather credential information.

SpecifyCredentials(IServiceProvider, String, String, String, Boolean, Boolean, String, String, String, EventHandler<CredentialInfoEventArgs>)

Displays a dialog box to gather credential information, using the specified event-handler delegate for saving changes.

SpecifyCredentials(IServiceProvider, String, String, String, Boolean, Boolean, String, String, String, EventHandler<CredentialInfoEventArgs>, EventHandler)

Displays a dialog box to gather credential information, using the specified event-handler delegates for saving changes and displaying Help.

SpecifyCredentials(IServiceProvider, String, String, String, Boolean, Boolean, String, String, String, EventHandler<CredentialInfoEventArgs>, EventHandler, Boolean)

Displays a dialog box to gather credential information, using the specified event-handler delegates for saving changes and displaying Help and the specified read-only parameter for the dialog box text.

SpecifyCredentials(IServiceProvider, String, String, String, Boolean, Boolean, String, String, String)

Displays a dialog box to gather credential information.

public:
 Microsoft::Web::Management::Client::CredentialInfo ^ SpecifyCredentials(IServiceProvider ^ serviceProvider, System::String ^ dialogTitleText, System::String ^ userName, System::String ^ password, bool isModify, bool verifyValidWindowsUserPassword, System::String ^ description, System::String ^ setSpecificCredentialsText, System::String ^ otherOptionText);
public Microsoft.Web.Management.Client.CredentialInfo SpecifyCredentials (IServiceProvider serviceProvider, string dialogTitleText, string userName, string password, bool isModify, bool verifyValidWindowsUserPassword, string description, string setSpecificCredentialsText, string otherOptionText);
abstract member SpecifyCredentials : IServiceProvider * string * string * string * bool * bool * string * string * string -> Microsoft.Web.Management.Client.CredentialInfo
Public Function SpecifyCredentials (serviceProvider As IServiceProvider, dialogTitleText As String, userName As String, password As String, isModify As Boolean, verifyValidWindowsUserPassword As Boolean, description As String, setSpecificCredentialsText As String, otherOptionText As String) As CredentialInfo

Parameters

serviceProvider
IServiceProvider

A IServiceProvider interface that that represents the service provider for gathering user credentials.

dialogTitleText
String

The title for the dialog box.

userName
String

The user name.

password
String

The user password.

isModify
Boolean

This parameter is reserved for future use.

verifyValidWindowsUserPassword
Boolean

true if the password should be verified for Windows; otherwise, false.

description
String

A description of the user.

setSpecificCredentialsText
String

The specific user.

otherOptionText
String

The alternate user.

Returns

A CredentialInfo object that is created with the parameters of this overload.

Examples

The following example implements this method.

public CredentialInfo SetCredentials(IServiceProvider serviceProvider,
bool verifyPW) {
    return this.SetCredentials(serviceProvider,
        verifyPW, null);
}

public CredentialInfo SetCredentials(IServiceProvider serviceProvider,
    bool verifyPW, EventHandler showHelp) {
    if (serviceProvider == null) {
        throw new ArgumentNullException("serviceProvider");
    }

    IManagementUIService uiService = (IManagementUIService)serviceProvider.
        GetService(typeof(IManagementUIService));
    Debug.Assert(uiService != null);

    CredentialInfo credentials = null;

    using (SetCredoDlg dialog =
        new SetCredoDlg(serviceProvider, showHelp)) {
        dialog.VerifyValidWindowsUserPassword = verifyPW;

        if (uiService.ShowDialog(dialog) == DialogResult.OK) {
            credentials = new CredentialInfo();
            credentials.UserName = dialog.UserName;
            credentials.Password = dialog.Password;
        }
    }

    return credentials;
} 

Remarks

If the userName parameter is null or empty, IIS uses pass-through authentication.

Applies to

SpecifyCredentials(IServiceProvider, String, String, String, Boolean, Boolean, String, String, String, EventHandler<CredentialInfoEventArgs>)

Displays a dialog box to gather credential information, using the specified event-handler delegate for saving changes.

public:
 Microsoft::Web::Management::Client::CredentialInfo ^ SpecifyCredentials(IServiceProvider ^ serviceProvider, System::String ^ dialogTitleText, System::String ^ userName, System::String ^ password, bool isModify, bool verifyValidWindowsUserPassword, System::String ^ description, System::String ^ setSpecificCredentialsText, System::String ^ otherOptionText, EventHandler<Microsoft::Web::Management::Client::CredentialInfoEventArgs ^> ^ commitHandler);
public Microsoft.Web.Management.Client.CredentialInfo SpecifyCredentials (IServiceProvider serviceProvider, string dialogTitleText, string userName, string password, bool isModify, bool verifyValidWindowsUserPassword, string description, string setSpecificCredentialsText, string otherOptionText, EventHandler<Microsoft.Web.Management.Client.CredentialInfoEventArgs> commitHandler);
abstract member SpecifyCredentials : IServiceProvider * string * string * string * bool * bool * string * string * string * EventHandler<Microsoft.Web.Management.Client.CredentialInfoEventArgs> -> Microsoft.Web.Management.Client.CredentialInfo
Public Function SpecifyCredentials (serviceProvider As IServiceProvider, dialogTitleText As String, userName As String, password As String, isModify As Boolean, verifyValidWindowsUserPassword As Boolean, description As String, setSpecificCredentialsText As String, otherOptionText As String, commitHandler As EventHandler(Of CredentialInfoEventArgs)) As CredentialInfo

Parameters

serviceProvider
IServiceProvider

A IServiceProvider interface that represents the service provider for gathering user credentials.

dialogTitleText
String

The title for the dialog box.

userName
String

The user name.

password
String

The user password.

isModify
Boolean

This parameter is reserved for future use.

verifyValidWindowsUserPassword
Boolean

true if the password should be verified for Windows; otherwise, false.

description
String

A description of the user.

setSpecificCredentialsText
String

The specific user.

otherOptionText
String

The alternate user.

commitHandler
EventHandler<CredentialInfoEventArgs>

The event-handler delegate that is used to save changes.

Returns

A CredentialInfo object that is created with the parameters of this overload.

Examples

The following example implements this method.

public CredentialInfo SetCredentials(IServiceProvider serviceProvider,
bool verifyPW) {
    return this.SetCredentials(serviceProvider,
        verifyPW, null);
}

public CredentialInfo SetCredentials(IServiceProvider serviceProvider,
    bool verifyPW, EventHandler showHelp) {
    if (serviceProvider == null) {
        throw new ArgumentNullException("serviceProvider");
    }

    IManagementUIService uiService = (IManagementUIService)serviceProvider.
        GetService(typeof(IManagementUIService));
    Debug.Assert(uiService != null);

    CredentialInfo credentials = null;

    using (SetCredoDlg dialog =
        new SetCredoDlg(serviceProvider, showHelp)) {
        dialog.VerifyValidWindowsUserPassword = verifyPW;

        if (uiService.ShowDialog(dialog) == DialogResult.OK) {
            credentials = new CredentialInfo();
            credentials.UserName = dialog.UserName;
            credentials.Password = dialog.Password;
        }
    }

    return credentials;
} 

Remarks

If the userName parameter is null or empty, IIS uses pass-through authentication.

Applies to

SpecifyCredentials(IServiceProvider, String, String, String, Boolean, Boolean, String, String, String, EventHandler<CredentialInfoEventArgs>, EventHandler)

Displays a dialog box to gather credential information, using the specified event-handler delegates for saving changes and displaying Help.

public:
 Microsoft::Web::Management::Client::CredentialInfo ^ SpecifyCredentials(IServiceProvider ^ serviceProvider, System::String ^ dialogTitleText, System::String ^ userName, System::String ^ password, bool isModify, bool verifyValidWindowsUserPassword, System::String ^ description, System::String ^ setSpecificCredentialsText, System::String ^ otherOptionText, EventHandler<Microsoft::Web::Management::Client::CredentialInfoEventArgs ^> ^ commitHandler, EventHandler ^ showHelp);
public Microsoft.Web.Management.Client.CredentialInfo SpecifyCredentials (IServiceProvider serviceProvider, string dialogTitleText, string userName, string password, bool isModify, bool verifyValidWindowsUserPassword, string description, string setSpecificCredentialsText, string otherOptionText, EventHandler<Microsoft.Web.Management.Client.CredentialInfoEventArgs> commitHandler, EventHandler showHelp);
abstract member SpecifyCredentials : IServiceProvider * string * string * string * bool * bool * string * string * string * EventHandler<Microsoft.Web.Management.Client.CredentialInfoEventArgs> * EventHandler -> Microsoft.Web.Management.Client.CredentialInfo
Public Function SpecifyCredentials (serviceProvider As IServiceProvider, dialogTitleText As String, userName As String, password As String, isModify As Boolean, verifyValidWindowsUserPassword As Boolean, description As String, setSpecificCredentialsText As String, otherOptionText As String, commitHandler As EventHandler(Of CredentialInfoEventArgs), showHelp As EventHandler) As CredentialInfo

Parameters

serviceProvider
IServiceProvider

A IServiceProvider interface that represents the service provider for gathering user credentials.

dialogTitleText
String

The title for the dialog box.

userName
String

The user name.

password
String

The user password.

isModify
Boolean

This parameter is reserved for future use.

verifyValidWindowsUserPassword
Boolean

true if the password should be verified for Windows; otherwise, false.

description
String

A description of the user.

setSpecificCredentialsText
String

The specific user.

otherOptionText
String

The alternate user.

commitHandler
EventHandler<CredentialInfoEventArgs>

The event-handler delegate that is used to save changes.

showHelp
EventHandler

The event-handler delegate that is used to display Help.

Returns

A CredentialInfo object that is created with the parameters of this overload.

Examples

The following example implements this method.

public CredentialInfo SetCredentials(IServiceProvider serviceProvider,
bool verifyPW) {
    return this.SetCredentials(serviceProvider,
        verifyPW, null);
}

public CredentialInfo SetCredentials(IServiceProvider serviceProvider,
    bool verifyPW, EventHandler showHelp) {
    if (serviceProvider == null) {
        throw new ArgumentNullException("serviceProvider");
    }

    IManagementUIService uiService = (IManagementUIService)serviceProvider.
        GetService(typeof(IManagementUIService));
    Debug.Assert(uiService != null);

    CredentialInfo credentials = null;

    using (SetCredoDlg dialog =
        new SetCredoDlg(serviceProvider, showHelp)) {
        dialog.VerifyValidWindowsUserPassword = verifyPW;

        if (uiService.ShowDialog(dialog) == DialogResult.OK) {
            credentials = new CredentialInfo();
            credentials.UserName = dialog.UserName;
            credentials.Password = dialog.Password;
        }
    }

    return credentials;
} 

Remarks

If the userName parameter is null or empty, IIS uses pass-through authentication.

Applies to

SpecifyCredentials(IServiceProvider, String, String, String, Boolean, Boolean, String, String, String, EventHandler<CredentialInfoEventArgs>, EventHandler, Boolean)

Displays a dialog box to gather credential information, using the specified event-handler delegates for saving changes and displaying Help and the specified read-only parameter for the dialog box text.

public:
 Microsoft::Web::Management::Client::CredentialInfo ^ SpecifyCredentials(IServiceProvider ^ serviceProvider, System::String ^ dialogTitleText, System::String ^ userName, System::String ^ password, bool isModify, bool verifyValidWindowsUserPassword, System::String ^ description, System::String ^ setSpecificCredentialsText, System::String ^ otherOptionText, EventHandler<Microsoft::Web::Management::Client::CredentialInfoEventArgs ^> ^ commitHandler, EventHandler ^ showHelp, bool readOnly);
public Microsoft.Web.Management.Client.CredentialInfo SpecifyCredentials (IServiceProvider serviceProvider, string dialogTitleText, string userName, string password, bool isModify, bool verifyValidWindowsUserPassword, string description, string setSpecificCredentialsText, string otherOptionText, EventHandler<Microsoft.Web.Management.Client.CredentialInfoEventArgs> commitHandler, EventHandler showHelp, bool readOnly);
abstract member SpecifyCredentials : IServiceProvider * string * string * string * bool * bool * string * string * string * EventHandler<Microsoft.Web.Management.Client.CredentialInfoEventArgs> * EventHandler * bool -> Microsoft.Web.Management.Client.CredentialInfo
Public Function SpecifyCredentials (serviceProvider As IServiceProvider, dialogTitleText As String, userName As String, password As String, isModify As Boolean, verifyValidWindowsUserPassword As Boolean, description As String, setSpecificCredentialsText As String, otherOptionText As String, commitHandler As EventHandler(Of CredentialInfoEventArgs), showHelp As EventHandler, readOnly As Boolean) As CredentialInfo

Parameters

serviceProvider
IServiceProvider

A IServiceProvider interface that represents the service provider for gathering user credentials.

dialogTitleText
String

The title for the dialog box.

userName
String

The user name.

password
String

The user password.

isModify
Boolean

This parameter is reserved for future use.

verifyValidWindowsUserPassword
Boolean

true if the password should be verified for Windows; otherwise, false.

description
String

A description of the user.

setSpecificCredentialsText
String

The specific user.

otherOptionText
String

The alternate user.

commitHandler
EventHandler<CredentialInfoEventArgs>

The event-handler delegate that is used to save changes.

showHelp
EventHandler

The event-handler delegate that is used to display Help.

readOnly
Boolean

true if the text boxes in the dialog box are read-only; false if the text boxes are read/write.

Returns

A CredentialInfo object that is created with the parameters of this overload.

Examples

The following example implements this method.

public CredentialInfo SetCredentials(IServiceProvider serviceProvider,
bool verifyPW) {
    return this.SetCredentials(serviceProvider,
        verifyPW, null);
}

public CredentialInfo SetCredentials(IServiceProvider serviceProvider,
    bool verifyPW, EventHandler showHelp) {
    if (serviceProvider == null) {
        throw new ArgumentNullException("serviceProvider");
    }

    IManagementUIService uiService = (IManagementUIService)serviceProvider.
        GetService(typeof(IManagementUIService));
    Debug.Assert(uiService != null);

    CredentialInfo credentials = null;

    using (SetCredoDlg dialog =
        new SetCredoDlg(serviceProvider, showHelp)) {
        dialog.VerifyValidWindowsUserPassword = verifyPW;

        if (uiService.ShowDialog(dialog) == DialogResult.OK) {
            credentials = new CredentialInfo();
            credentials.UserName = dialog.UserName;
            credentials.Password = dialog.Password;
        }
    }

    return credentials;
} 

Remarks

If the userName parameter is null or empty, IIS uses pass-through authentication. If the readOnly parameter is false, users can change the text in the text boxes.

Applies to