public static SharePointServiceSection Open(string path)
        {
            if ((object)_instance == null)
            {
                if (path.EndsWith(".config", System.StringComparison.InvariantCultureIgnoreCase))
                {
                    path = path.Remove(path.Length - 7);
                }

                var config = ConfigurationManager.OpenExeConfiguration(path);
                if (config != null)
                {
                    _instance = (SharePointServiceSection)config.Sections[_configSection];
                }
            }

            return(_instance);
        }
        static HandlerFactory()
        {
            lock (_lock)
            {
                var hasLoadedTypes = false;

                try
                {
                    if (_handlerTypes == null || _handlerTypes.Count == 0)
                    {
                        // get services from web.config
                        _serviceSection = (SharePointServiceSection)ConfigurationManager.GetSection("titSharePointSSOMServices");

                        if (_serviceSection != null)
                        {
                            foreach (ServiceRegistry service in _serviceSection.Services)
                            {
                                List <Type> exportedTypes;

                                if (service.FilterType == FilterType.AssemblyName)
                                {
                                    if (string.IsNullOrEmpty(service.AssemblyName))
                                    {
                                        throw new Exception("AssemblyName not defined");
                                    }

                                    // load the services defined in the referenced assembly
                                    exportedTypes = Assembly.Load(service.AssemblyName)
                                                    .ExportedTypes.Where(i => i.GetInterface("IHttpHandler", true) != null)
                                                    .ToList();

                                    // load types
                                    AddIfNotExistsExportedTypes(exportedTypes);
                                }
                                else
                                {
                                    if (!hasLoadedTypes)
                                    {
                                        // load the services defined in the current assembly
                                        exportedTypes = AppDomain.CurrentDomain.GetAssemblies()
                                                        .SelectMany(t => t.GetTypes())
                                                        .Where(t => t.IsClass && t.IsPublic && t.Namespace == service.Namespace).ToList();

                                        // load types
                                        AddIfNotExistsExportedTypes(exportedTypes);

                                        // mark types as loaded
                                        hasLoadedTypes = true;
                                    }
                                }
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    // log error
                    Logger.Logger.Unexpected("HandlerFactory.constructor", e.Message);

                    // return error message
                    ResponseJSON(HttpContext.Current.Response, e);
                }
            }
        }