Themelia Pro A powerful new development platform built on ASP.NET.
Understanding Init Processors

Init processors allow you to insert any custom logic that is required to run before any other part of the system. These also run before any HTTP handlers as well as before any other feature of Themelia. You can use init processors for many things, but they were originally designed to setup the environment for the HTTP handlers (including your Page class).

For instance, perhaps you want to parse the query string, set a context item, look for a certain browser or even want to pull something directly from the HTTP POST or modify viewstate. This is a good place to do those things. All your settings will be in place before your HTTP handlers are called and, therefore, before web forms even think about loading. So, this is your chance to do control processing before even the web form constructor runs.

Init processors are by far and away the most used of the pipeline processors. One example of using a init processor is in the Minima Blog Engine. This application uses an init processor to parse the URL to find out whether the user is accessing a post, a label, an index, or an archive. It then also does all data-tier access to ensure that the data is available for the rest of the request.

A Init processor is made by creating a class that inherits from Themelia.Web.Processing.InitProcessorBase. This is an abstract class that requires you to implement the following signature.

InitProcessorBase Execute(HttpContext context, params Object[] parameterArray)


Init processors can be installed in a few different ways: chaining, via web components, and via config. Chaining will be discussed in a moment and web components will be discussed in the component section. Installation via config simply consists of adding an "add" element to a web domain's processors collection. Here is an example:

        <add type="Forum.Web.InitProcessor, Forum.Web" />

It's highly recommendedt that you always use a processor factory for all processors. See the processor factory section for more information.


Init processors have a special feature known as chaining. This feature allows you to use custom logic to see if you want to run another init processor. To use chaining, just return an instance of a different init processor. When the current processor finishes executing, the one your returned will immediately run

You can set the context and parameterArray be using the following method signature:

InitProcessorBase Initialize(HttpContext context, params Object[] parameterArray);

Programmatic Parameters

When setting up an init parameter programmatically, you can pass in various parameters via the parameters object array. The init processor itself can then look at the parameters array and cast the value to whatever value neccesary. Below is an example of this:

namespace Sample.Forum.Processing
    public class InitProcessor : Themelia.Web.Processing.InitProcessorBase
        //- @Execute -//
        public override InitProcessorBase Execute(HttpContext context, params Object[] parameterArray)
            if (!Themelia.Collection.IsNullOrEmpty(parameterArray))
                HttpData.SetScopedItem<String>("__$Forum", "ForumGuid", parameterArray[0] as String);
            return null;
        //- $ParserUrl -//
        private void ParserUrl()
            //TODO: parse URL here

Config Parameters