Share via


IAuthenticationModuleService.IsEnabled Method

Definition

Determines whether the specified authentication module service is enabled.

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

Returns

true if the IAuthenticationModuleService interface is enabled; otherwise, false.

Examples

The following example checks the authentication module services, defined in the Administration.config file, and displays the IsEnabled method return values.

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;
        }
    }
}

Remarks

You can use this method to determine the authentication module service that is used on your site.

Applies to