SaaS CMS has officially launched! Learn more now.

Class InitializationModule

Initialization of the EPiServer CMS runtime.

Inheritance
System.Object
InitializationModule
Implements
System.Web.IHttpModule
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Web
Assembly: EPiServer.dll
Version: 7.19.2
Syntax
public class InitializationModule : IHttpModule, IInitializableModule

Constructors

InitializationModule()

Declaration
public InitializationModule()

Properties

HostType

Gets or sets the type of the host.

Declaration
public static HostType HostType { get; set; }
Property Value
Type Description
HostType

The type of the host.

Methods

Initialize(EPiServerSection, Settings)

Initializes parts of EPiServer. This method can help when setting up the environment outside of a web context, e.g. during testing.

Declaration
[Obsolete("Initialization in CMS is based on the InitializationEngine in Framework, this method no longer works", true)]
public static void Initialize(EPiServerSection config, Settings settings)
Parameters
Type Name Description
EPiServerSection config
Settings settings

Initialize(EPiServerSection, Settings, ConnectionStringSettingsCollection)

Initializes parts of EPiServer. This method can help when setting up the environment outside of a web context, e.g. during testing.

Declaration
[Obsolete("Initialization in CMS is based on the InitializationEngine in Framework, this method no longer works", true)]
public static void Initialize(EPiServerSection config, Settings settings, ConnectionStringSettingsCollection connectionStringSettings)
Parameters
Type Name Description
EPiServerSection config
Settings settings
System.Configuration.ConnectionStringSettingsCollection connectionStringSettings

Initialize(InitializationEngine)

Initializes this instance.

Declaration
public void Initialize(InitializationEngine context)
Parameters
Type Name Description
InitializationEngine context

The context.

Remarks

Gets called as part of the EPiServer Framework initialization sequence. Note that it will be called only once per AppDomain, unless the method throws an exception. If an exception is thrown, the initialization method will be called repeadetly for each request reaching the site until the method succeeds.

Preload(String[])

Preloads the module.

Declaration
public void Preload(string[] parameters)
Parameters
Type Name Description
System.String[] parameters

The parameters.

Remarks

This method is only available to be compatible with "AlwaysRunning" applications in .NET 4 / IIS 7. It currently serves no purpose.

StaticInitialization()

Do static initialization that requires a valid HttpContext.

Declaration
[Obsolete("Initialization in CMS is based on the InitializationEngine in Framework, this method no longer works", true)]
public static void StaticInitialization()
Remarks

This method is called AFTER Application_Start, AFTER HttpModule.Init and AFTER the Init method.

Uninitialize()

Uninitializes the EPiServer CMS runtime.

Declaration
[Obsolete("Initialization in CMS is based on the InitializationEngine in Framework, this method no longer works", true)]
public static void Uninitialize()

Uninitialize(InitializationEngine)

Resets the module into an uninitialized state.

Declaration
public void Uninitialize(InitializationEngine context)
Parameters
Type Name Description
InitializationEngine context

The context.

Remarks

This method is usually not called when running under a web application since the web app may be shut down very abruptly, but your module should still implement it properly since it will make integration and unit testing much simpler.

Any work done by Initialize(InitializationEngine) as well as any code executing on InitComplete should be reversed.

Events

FirstBeginRequest

An event that will fire exactly once on the first request coming to the app domain.

Declaration
[Obsolete("Attaching to FirstBeginRequest should be avoided. Rewrite your code to implement an IInitializableModule instead. This event fires only on sites upgraded from version 6.")]
public static event EventHandler FirstBeginRequest
Event Type
Type Description
System.EventHandler
Remarks

Note that this event will make sure that an event handler is added only once. I e if you add several instances of the same event handler, the event handler will be called only once. Adding the handler more than once will be the case if you simply do

Global.Application_FirstBeginRequest += MyHandler; 

from the Init method of an HttpModule, since the HttpModule may be created more than once. The reason for this behavior is to allow for static initialization to take place in modules without having to keep track of first/subsequent events.

Implements

System.Web.IHttpModule

Extension Methods