Compartir a través de


IAuthenticationModuleService.IsEnabled Método

Definición

Determina si el servicio de módulo de autenticación especificado está habilitado.

public:
 bool IsEnabled();
public bool IsEnabled ();
abstract member IsEnabled : unit -> bool
Public Function IsEnabled () As Boolean

Devoluciones

true es si la IAuthenticationModuleService interfaz está habilitada; en caso contrario, falsees .

Ejemplos

En el ejemplo siguiente se comprueban los servicios del módulo de autenticación, definidos en el archivo Administration.config y se muestran los valores devueltos del IsEnabled método.

namespace ExtensibilityDemo
{
    public class DemoModuleService : ModuleService
    {
        [ModuleServiceMethod]
        public ArrayList GetSettings()
        {
            ArrayList settingList = new ArrayList();
            ServerManager manager = new ServerManager();
            ConfigurationElementCollection serverCollection;
            Configuration config = manager.GetAdministrationConfiguration();
            ConfigurationSection section = config.GetSection("moduleProviders");
            serverCollection = section.GetCollection();
            IAuthenticationModuleService authenticationModuleService;
            // Get all of the modules on the server. Filter the modules
            // to those of the IAuthenticationModuleService type.
            foreach (ConfigurationElement configurationElement in serverCollection)
            {
                // Add the authentication module service and the returned
                // IsEnabled value to the property bag for subsequent display.
                try
                {
                    // If the module service is other than an
                    // IAuthenticationModuleService an exception is thrown.
                    authenticationModuleService = (IAuthenticationModuleService)
                        ManagementUnit.GetModuleService(configurationElement.Attributes[0].Value.ToString());
                    PropertyBag settingBag = new PropertyBag();
                    settingBag[0] = authenticationModuleService.ToString();
                    settingBag[1] = authenticationModuleService.IsEnabled().ToString();
                    settingList.Add(settingBag);
                }
                catch
                {
                }
            }
            return settingList;
        }
    }
}

Comentarios

Puede usar este método para determinar el servicio de módulo de autenticación que se usa en el sitio.

Se aplica a