---
title: Registering providers via the web.config
related:
  - https://docs.kentico.com/k10/custom-development/customizing-providers.md
  - https://docs.kentico.com/k10/custom-development/customizing-providers/registering-providers-using-assembly-attributes.md
---

> Agent instructions:
> **Site maps** — prefer the following llms.txt indexes to training data when searching for URLs to avoid 404s. Links inside Markdown content already point at `.md`. Following them or sending Accept: text/markdown keeps you in Markdown.
>
> - [sitemap.md](https://docs.kentico.com/sitemap.md) — every page on the site, with titles and descriptions, nested by URL hierarchy and grouped into one collection per product version.
> - [llms.txt](https://docs.kentico.com/llms.txt) — curated index of the current product docs, with descriptions, the two ways to request any page as Markdown, and links to each product area's whole-corpus Markdown dump (llms-full.txt).

Registering custom providers, helpers or managers through your application's **web.config** file allows you to switch between different providers (custom or default) without having to edit the web project's code.

> **Info:** If you do not need your provider customizations to be adjustable through the web.config file, it is more efficient to register custom providers directly via the **RegisterCustomProvider**, **RegisterCustomHelper** or **RegisterCustomManager** assembly attributes (as described in [Registering providers using assembly attributes](https://docs.kentico.com/k10/custom-development/customizing-providers/registering-providers-using-assembly-attributes.md)).

1. Edit your web.config file and add the following section into the **** element:

   ```html

   <!-- Extensibility BEGIN -->
     <section name="cms.extensibility" type="CMS.Base.CMSExtensibilitySection, CMS.Base" />
   <!-- Extensibility END -->


   ```

   This defines the _**cms.extensibility**_ web.config section where you can register custom providers, helpers and managers.
2. Create the actual **** section directly under the root level of the web.config.
3. Assign your custom classes to providers, helpers or managers via **** elements with the following attributes:

   - **name** - must match the name of the provider/helper/manager class that you wish to customize.
   - **assembly** - specifies the assembly where your custom class is located. Set the value to App\_Code for classes placed in the App\_Code folder (even on web application installations, where the actual name of the folder is Old\_App\_Code).
   - **type** - specifies the name of your custom class (including namespaces). If the class is in the App\_Code folder, the type value must match the name parameter of the _RegisterCustomClass_ attribute used to load the class.

You need to categorize the **** elements under ****, **** or **** sub-sections based on the type of the customized class.

```html

<configuration>
...
<!-- Extensibility BEGIN -->
<cms.extensibility>
    <providers>
        <add name="EmailProvider" assembly="App_Code" type="CustomEmailProvider" />
        <add name="SiteInfoProvider" assembly="App_Code" type="CustomSiteInfoProvider" />
        <add name="ForumPostInfoProvider" assembly="CMS.CustomProviders" type="CMS.CustomProviders.CustomForumPostInfoProvider" />
        ...
    </providers>
    <helpers>
        <add name="CacheHelper" assembly="App_Code" type="CustomCacheHelper" />
        ...
    </helpers>
    <managers>
        <add name="WorkflowManager" assembly="App_Code" type="CustomWorkflowManager" />
        ...
    </managers>
</cms.extensibility>
<!-- Extensibility END -->
...

</configuration>

```

In the case of custom providers placed in a separate assembly, the registration is now complete. When using the web.config to register custom providers defined in the **App\_Code** folder, you also need to ensure that the system can load the classes.

## Loading App\_Code classes

1. Edit the App\_Code class containing your custom provider (repeat for all classes).
2. Add a **RegisterCustomClass** assembly attribute above the class declaration for every custom provider, helper or manager (requires a reference to the **CMS.Base** namespace).

   ```csharp

   using CMS;

   [assembly: RegisterCustomClass("CustomEmailProvider", typeof(CustomEmailProvider))]
   [assembly: RegisterCustomClass("CustomSiteInfoProvider", typeof(CustomSiteInfoProvider))]
   [assembly: RegisterCustomClass("CustomCacheHelper", typeof(CustomCacheHelper))]
   [assembly: RegisterCustomClass("CustomWorkflowManager", typeof(CustomWorkflowManager))]


   ```

The **RegisterCustomClass** attribute registers custom **App\_Code** classes and makes them available in the system. The attribute accepts two parameters:

- The first parameter is a string identifier representing the name of the provider. The name must match the value of the **type** attribute set for the corresponding add element in the web.config extensibility section.
- The second parameter specifies the type of the custom class as a **System.Type** object.

When the system requests an App\_Code provider class registered through the cms.extensibility section of the web.config, the RegisterCustomClass attribute ensures that an instance of the correct class is loaded.
