ControlBuilderInterceptor class

The ControlBuilderInterceptor class allows the compilation process to be customized or controlled.


internal class ControlBuilderInterceptor


The ControlBuilderInterceptor class is internal and is not meant to be used directly in your code.

As described in the Remarks section, the existence of this type can be checked to determine whether interceptor type support is present. Microsoft does not support any other use of this class in a production application under any circumstance.


In .NET Framework 2.0 and .NET Framework 3.5, the August 2020 updates added support for using an interceptor type to customize or control the compilation process. You can determine whether this support is present by using Type.GetType() to check the existence of the ControlBuilderInterceptor type, as demonstrated in the following code.

Type type = Type.GetType("System.Web.Compilation.ControlBuilderInterceptor, System.Web, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");

If the return value is non-null, then interceptor support is present. If the return value is null, or if an exception is thrown, then the August 2020 updates have not been installed, and interceptor support is absent.

If interceptor support is present, you can write and register an interceptor type that will interact with the compilation process in exactly the same way that ControlBuilderInterceptor does on later versions of .NET Framework. In .NET Framework 2.0 and .NET Framework 3.5, the interceptor type can be any class that meets the following requirements:

Register the interceptor type by using the aspnet:20ControlBuilderInterceptor key in ASP.NET application settings (<appSettings>). This application setting must be listed in your computer or application web.config file. Specify the interceptor type by using its assembly-qualified type name. The following example shows how to register an interceptor type named Fabrikam.Interceptor.

    <add key="aspnet:20ControlBuilderInterceptor"
         value="Fabrikam.Interceptor, Fabrikam, Version=, Culture=neutral, PublicKeyToken=2b3831f2f2b744f7" />

To retrieve the assembly-qualified name of a type, use the Type.AssemblyQualifiedName property, as demonstrated in the following code.

string assemblyQualifiedName = typeof(Fabrikam.Interceptor).AssemblyQualifiedName;

When interceptor support is present, the compilation process interacts with the listed type in the manner described above. When interceptor support is absent, the application setting is ignored and has no effect.


Namespace: System.Web.Compilation

Assembly: System.Web (in System.Web.dll)

.NET Framework versions: 3.5, 2.0