Is this really the version you are looking for? Kentico Xperience 12 Service Pack Documentation is no longer updated. Use the switcher in the header to choose your product version.
Namespace: CMS.DataEngine
Contains events that occur for all types of objects in the system. See also: Handling object events
Important
Use the following classes to access the object events in the API:
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Insert | Before | ObjectEventArgs Properties
| Occurs when a new object is created. To reliably handle all possible object creation events, you may also need to assign a matching handler to the BulkInsert event. The system triggers the BulkInsert event instead of Insert in certain cases, particularly for operations that can affect multiple objects. |
Update | Before | ObjectEventArgs Properties
| Occurs when the data of an existing object is updated. To reliably handle all possible object update events, you may also need to assign a matching handler to the BulkUpdate event. The system triggers the BulkUpdate event instead of Update in certain cases, particularly for operations that can affect multiple objects. |
Delete | Before | ObjectEventArgs Properties
| Occurs when an object is deleted. To reliably handle all possible object deletion events, you may also need to assign a matching handler to the BulkDelete event. The system triggers the BulkDelete event instead of Delete in certain cases, particularly for operations that can affect multiple objects. |
BulkInsert | Before | BulkInsertEventArgs Properties
| Occurs when the system performs object creation operations that can affect multiple objects. To reliably handle all possible object creation events, assign matching handlers to both the BulkInsert and Insert events. In certain cases, the system creates objects by directly inserting data into a database table (for example when importing contacts from CSV files). To cover these scenarios, you also need to assign an appropriate handler to the SqlEvents.BulkInsert event. |
BulkUpdate | Before | BulkUpdateEventArgs Properties
| Occurs when the system performs object update operations that can affect multiple objects. To reliably handle all possible object update events, assign matching handlers to both the BulkUpdate and Update events. |
BulkDelete | Before | BulkDeleteEventArgs Properties
| Occurs when the system performs object deletion operations that can affect multiple objects. To reliably handle all possible object deletion events, assign matching handlers to both the BulkDelete and Delete events. |
GetContent | Execute | ObjectEventArgs Properties
| Occurs before the system writes an object's data into smart search indexes (when building or updating indexes). Allows you to determine exactly how search indexes store object content. |
LogChange | Before | LogObjectChangeEventArgs Properties
| Occurs when the system logs object changes for the purposes of staging and integration. For example, allows you to exclude specific objects from staging. |
CheckPermissions | Before | ObjectSecurityEventArgs Properties
| Occurs when the system checks permissions for objects of the given type. |
Sort | Before | ObjectSortEventArgs Properties
| Occurs when sorting of objects is requested. |
ChangeOrder | Before | ObjectChangeOrderEventArgs Properties
| Occurs when a change in the order of objects is requested. |
GetData | Before | ObjectDataEventArgs Properties
| Occurs when the system retrieves object data using the ObjectQuery API. The Before event type is suitable, for example, when you want to retrieve data from an external source. Assign the external data into the Data property of the handler's ObjectDataEventArgs parameter, which is empty by default in the Before event. Use the After event type if you need to edit the data retrieved from Kentico in the Data property. The TotalRecords property provides a number of total records in case paging is used. Use -1 to use the rows count of the Data property. |
Namespace: CMS.DocumentEngine
Contains events fired when changes are made to pages.
Note:
Pages under workflow require a different approach to event handling. Use the events from the WorkflowEvents class instead of DocumentEvents.
For example, to handle the 'update' action for a page under workflow, use the SaveVersion event from WorkflowEvents instead of the DocumentEvents.Update event.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Insert | Before | DocumentEventArgs Properties
| Occurs when a new page is created. |
InsertNewCulture | Before | DocumentEventArgs Properties
| Occurs when a new culture version is created for a page. |
InsertLink | Before | DocumentEventArgs Properties
| Occurs when creating new linked pages. |
Update | Before | DocumentEventArgs Properties
| Occurs when an existing page is updated. |
Move | Before | DocumentEventArgs Properties
| Occurs when a page is moved to a different position in the site's content tree. |
Copy | Before | DocumentEventArgs Properties
| Occurs when a new copy of a page is created. |
Delete | Before | DocumentEventArgs Properties
| Occurs when a page is deleted. |
GetContent | Execute | DocumentSearchEventArgs Properties
| Occurs before the system writes a page's data into a Smart search index (when building or updating indexes). Allows you to determine exactly how search indexes store page content. |
LogChange | Before | LogDocumentChangeEventArgs Properties
| Occurs when the system logs page changes for the purposes of staging and integration. For example, allows you to exclude specific pages from staging. |
CheckPermissions | Before | DocumentSecurityEventArgs Properties
| Occurs when the system checks permissions for pages. Note: This event does not occur on the live site. For checking permissions on the live site, see the AuthorizeDocument event. |
Sort | Before | DocumentSortEventArgs Properties
| Occurs when sorting of pages is requested. |
ChangeOrder | Before | DocumentChangeOrderEventArgs Properties
| Occurs when a change in the order of pages is requested. |
GetData | Before | DocumentDataEventArgs Properties
| Occurs when the system retrieves page data using the DocumentQuery API. The Before event type is suitable, for example, when you want to retrieve data from an external source. Assign the external data into the Data property of the handler's DocumentDataEventArgs parameter, which is empty by default in the Before event. Use the After event type, when you want to edit the data retrieved from Kentico in the Data property. The TotalRecords property provides a number of total records in case paging is used. Use -1 to use rows count of the Data property. |
Page attachments | |||
SaveAttachment | Before | DocumentEventArgs Properties
| Occurs when a file attachment is added to a page or updated. |
DeleteAttachment | Before | DocumentEventArgs Properties
| Occurs when a file attachment is removed from a page. |
Page security | |||
AuthorizeDocument | Execute | DocumentAuthorizationEventArgs Properties
| Occurs when the system performs a security check for the permissions of a specific page. You can modify the result of the security check by adding your own conditions and setting the AuthorizationResult property of the handler's DocumentAuthorizationEventArgs parameter. |
FilterDataSetByPermissions | Execute | DocumentAuthorizationEventArgs Properties
| Occurs when the system filters a set of pages according to the page permissions of a user. You can modify the filtering by adding your own conditions and modifying the page data in the Data property of the handler's DocumentAuthorizationEventArgs parameter. |
Namespace: CMS.DocumentEngine
Contains events related to workflow and versioning actions.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Approve | Before | WorkflowEventArgs Properties
| Occurs when a page is approved to the next step. |
Reject | Before | WorkflowEventArgs Properties
| Occurs when a page is rejected back to a previous step |
Publish | Before | WorkflowEventArgs Properties
| Occurs when a page reaches the published step. |
Archive | Before | WorkflowEventArgs Properties
| Occurs when a page is archived. |
Action | Before | WorkflowActionEventArgs<TreeNode, BaseInfo, WorkflowActionEnum> Requires references to:
| Occurs when executing advanced workflow action steps. |
Page versioning | |||
SaveVersion | Before | WorkflowEventArgs Properties
| Occurs when the edited version of a page is updated. |
SaveAttachmentVersion | Before | WorkflowEventArgs Properties
| Occurs when an attachment is updated or inserted for the edited version of a page. |
RemoveAttachmentVersion | Before | WorkflowEventArgs Properties
| Occurs when an attachment is removed for the edited version of a page. |
Content locking | |||
CheckOut | Before | WorkflowEventArgs Properties
| Occurs when a page is checked-out. |
CheckIn | Before | WorkflowEventArgs Properties
| Occurs when a page is checked-in. |
UndoCheckOut | Before | WorkflowEventArgs Properties
| Occurs when a user performs the undo check-out action. |
Namespace: CMS.Membership
Contains security and authentication events.
Note: SecurityEvents are only raised for the Kentico administration interface and websites built using the Portal Engine development model. The events do not occur when users sign in or out on MVC sites, which use membership functionality based on ASP.NET Identity (as described in Integrating Kentico membership).
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Authenticate | Execute | AuthenticationEventArgs Properties
| Occurs when authenticating users. See also: Handling custom external authentication |
AuthenticationRequested | Execute | AuthenticationRequestEventArgs Properties
| Occurs when a user accesses a restricted section of Kentico and the user's authentication is required. |
MultiFactorAuthenticate | Execute | AuthenticationEventArgs Properties
| Occurs when a user tries to sign in to Kentico with multi-factor authentication enabled. |
AuthorizeResource | Execute | AuthorizationEventArgs Properties
| Occurs when checking the permissions for modules. |
AuthorizeClass | Execute | AuthorizationEventArgs Properties
| Occurs when performing security checks for object type or page type permissions. |
AuthorizeUIElement | Execute | AuthorizationEventArgs Properties
| Occurs when checking permissions for UI elements. |
SignOut | Before | SignOutEventArgs Properties
| Occurs when a user signs out from a website. |
Namespace: CMS.DataProtection
Contains events related to protection of personal data in the system.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
RevokeConsentAgreement | Execute | RevokeConsentAgreementEventArgs Properties
| Occurs when a consent agreement is revoked. When a contact's consent agreement is revoked, this event can be used to perform custom actions, such as terminating tracking of the contact or deleting personal data related to the contact. See also: Creating consents, Working with consents on MVC sites, Revoking consent agreements (Portal Engine sites) |
Namespace: CMS.EventLog
Contains events that occur when logging records into the system's event log.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
LogEvent | Before | LogEventArgs Properties
| Occurs when the system logs a record into the event log. You can use the Before event to customizing the data logged for events or cancel logging for certain types of events. The After event allows you to perform custom actions after events are successfully logged, for example duplicate certain types of events into a custom log. See also: Customizing event logging |
Namespace: CMS.Synchronization
Contains events that occur when using content staging for pages and objects.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
GetChildProcessingType | Execute | StagingChildProcessingTypeEventArgs Properties
| Occurs on the target server when processing create or update staging tasks that include the data of child or binding objects (once for each child or binding type). For example, staging tasks for roles include the data of binding objects, such as user-role and role-permission relationships. When processing a create or update staging task for a role, the GetChildProcessingType event triggers separately for each binding type included in the role data. You can use the event to customize how the system handles child and binding object data during staging. For more information, see Customizing staging of child and binding objects. |
LogTask | Before | StagingLogTaskEventArgs Properties
| Occurs when creating staging tasks on the source server after a page or object is changed in the system. See also: |
Synchronize | Before | CMSEventArgs | Occurs on the source server when synchronizing staging tasks – once per synchronize action, even when processing multiple tasks. |
SynchronizeTask | Before | StagingTaskEventArgs Properties
| Occurs on the source server when synchronizing staging tasks – separately for every processed task. |
ProcessTask | Before | StagingSynchronizationEventArgs Properties
| Occurs on the target server when processing incoming staging tasks. The processing of the staging tasks then also triggers the corresponding DocumentEvents or ObjectEvents (Insert, Update, Delete, etc.). |
Namespace: CMS.Synchronization
Contains events that occur when synchronizing pages or objects between Kentico and other applications using the integration bus.
See also:
Event | Event types | Handler parameters | Description |
|---|---|---|---|
LogInternalTask | Before | IntegrationTaskEventArgs Properties
| Occurs when creating outgoing integration tasks after a page or object in the system is changed. |
LogExternalTask | Before | IntegrationTaskEventArgs Properties
| Occurs when the system creates incoming tasks provided by an integration connector. |
Namespace: CMS.CMSImportExport
Contains events related to import and export actions.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Import | Before | ImportBaseEventArgs Properties
| Occurs at the start of the import process. |
ImportObject | Before | ImportEventArgs Properties
| Occurs once for every imported object. |
ImportObjects | Before | ImportDataEventArgs Properties
| Occurs when importing sets of objects. |
ImportBinding | Before | ImportEventArgs Properties
| Occurs once for every imported binding object. |
ImportBindings | Before | ImportEventArgs Properties
| Occurs when importing binding objects. |
ImportChild | Before | ImportEventArgs Properties
| Occurs once for every imported child object. |
ImportChildren | Before | ImportEventArgs Properties
| Occurs when importing child objects. |
GetImportData | Before | ImportGetDataEventArgs Properties
| Occurs when importing data. Allows you to work with the data set in the import package created for a specific object types.
|
ProcessFileOperation | Before | ImportProcessFileOperationEventArgs Properties
| Occurs when processing file/folder operations in the import package. |
ImportCanceled | Execute | ImportBaseEventArgs Properties
| Occurs when a user cancels the import process. |
ImportError | Execute | ImportErrorEventArgs Properties
| Fires when an error occurs during the import process. |
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Export | Before | ExportEventArgs Properties
| Occurs at the start of the export process. |
ExportObjects | Before | ExportEventArgs Properties
| Occurs when exporting objects. |
GetExportData | Before | ExportGetDataEventArgs Properties
| Occurs when exporting data. Allows you to work with the data set in the export package created for specific object types.
|
SingleExportSelection | Execute | SingleExportSelectionEventArgs Properties
| Occurs when selecting related objects during single object export. Allows you to attach related objects to the export package. |
ExportCanceled | Execute | ExportBaseEventArgs Properties
| Occurs when a user cancels the export process. |
ExportError | Execute | ExportErrorEventArgs Properties
| Fires when an error occurs during the export process. |
Namespace: CMS.DocumentEngine
Contains events related to import and export of pages.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
ExportDocuments | Before | DocumentsExportEventArgs Properties
| Occurs when exporting pages. |
ImportDocument | Before | DocumentImportEventArgs Properties
| Occurs once for every imported page. |
ImportDocuments | Before | DocumentImportEventArgs Properties
| Occurs when importing pages. |
Namespace: CMS.DataEngine
When transferring data between instances of Kentico (via import/export or staging), the IDs of objects can differ between the environments. Kentico automatically "translates" the ID values for system objects, but not for custom objects. For example, when you stage a custom table or page type that contains a custom field storing object IDs, the values may not match the IDs of the objects on the target server. The ColumnsTranslationEvents allow you to ensure that the IDs are translated correctly.
See also: Deploying objects with custom ID fields
Event | Event types | Handler parameters | Description |
|---|---|---|---|
RegisterRecords | Execute | ColumnsTranslationEventArgs Properties
| Occurs when exporting objects. Allows you to provide additional information for the translation of custom ID fields. |
TranslateColumns | Execute | ColumnsTranslationEventArgs Properties
| Occurs when importing objects. Allows you to translate the values of custom ID fields using the provided information. |
Namespace: CMS.Modules
Contains events that occur when the system generates installation packages for custom modules.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
BuildNuSpecManifest | Before | BuildNuSpecManifestEventArgs Properties
| Occurs when the system creates the .nuspec file for module NuGet packages. The file is an XML manifest containing package metadata. See the .nuspec reference (opens in a new tab) for more information. The event allows you to customize the package metadata for your modules:
The ResourceName property of the handler's BuildNuSpecManifestEventArgs parameter contains the code name of the module for which the package is being created. |
Namespace: CMS.OnlineForms
Contains events related to form actions. See Working with form data using the API for an example.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Insert | Before | BizFormItemEventArgs Properties
| Occurs when inserting new form items (data records of on-line forms). |
Update | Before | BizFormItemEventArgs Properties
| Occurs when updating form data records. |
Delete | Before | BizFormItemEventArgs Properties
| Occurs when deleting data records from forms. |
Namespace: CMS.CustomTables
Contains events related to custom table actions. See Custom table internals and API.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Insert | Before | CustomTableItemEventArgs Properties
| Occurs when inserting new custom table items (data records stored in a custom table). |
Update | Before | CustomTableItemEventArgs Properties
| Occurs when updating custom table items. |
Delete | Before | CustomTableItemEventArgs Properties
| Occurs when deleting custom table items. |
Namespace: CMS.Ecommerce
Contains events related to the E-commerce solution.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
NewOrderCreated | Execute | NewOrderCreatedEventArgs Properties
| Fires when a new order is created. The event triggers only when the order is created based on an existing shopping cart. For example, the event does not trigger if an order is created within code using the OrderInfoProvider API. |
OrderPaid | Execute | OrderPaidEventArgs Properties
| Fires when an order becomes paid. |
ProductAddedToShoppingCart | Execute | ProductAddedToCartEventArgs Properties
| Fires when a customer adds a product to their shopping cart. The event occurs only once when multiple units of the same product are added to the cart within a single action (the ShoppingCartItem object available in the event's ProductAddedToCartEventArgs parameter can represent any number of product units). |
Namespace: CMS.Newsletters
Contains events related to Email marketing.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
ResolveMacros | Before | ResolveMacrosEventArgs Properties
| Occurs when all email feed text macros are resolved. |
GenerateQueueItems | Before | GenerateQueueItemsEventArgs Properties
| Occurs when an email feed is sent to one or more recipients. You can use this event to manually add emails to the queue for custom recipients. Note: The GeneratedEmails property is used only with Newsletter email feeds and its primary purpose is to check duplicates in the newsletter recipients. |
GeneratePreview | Before | GeneratePreviewEventArgs Properties
| Occurs when an email preview is generated for a recipient. |
SubscriberUnsubscribes | Execute | UnsubscriptionEventArgs Properties
| Occurs when a recipient unsubscribes from an email feed. |
SubscriberOpensEmail | Execute | LinksEventArgs Properties
| Occurs when a recipient opens an email and the open email tracking feature is enabled. |
SubscriberClicksTrackedLink | Execute | LinksEventArgs Properties
| Occurs when a recipient clicks an email link and the email link tracking feature is enabled. |
Namespace: CMS.WebAnalytics
Event | Event types | Handler parameters | Description |
|---|---|---|---|
CheckAnalyticsConsent | Execute | CheckAnalyticsConsentEventArgs Properties
| Occurs before the system logs any web analytics for visitors (before any processing of the visitor's personal data). Allows you to disable logging of web analytics based on consent. Assign a handler to the event, create a condition according to your website's consent requirements, and set the HasConsent property of the handler's CheckAnalyticsConsentEventArgs parameter based on the result. |
LogConversion | Before | CMSEventArgs<LogRecord> | Occurs when a custom conversion is logged. You can access the data of the custom conversion via the Parameter property of the CMSEventArgs parameter. |
ProcessLogRecord | Before | CMSEventArgs<LogRecord> | Occurs when the web analytics log is processed. |
ProcessAnalyticsService | Before | AnalyticsJSEventArgs Properties
| Occurs when the system logs any web analytics. |
InsertAnalyticsJS | Before | AnalyticsJSEventArgs Properties
| Occurs when the web analytics JavaScript snippet is inserted into the page. |
CampaignLaunched | Execute | CMSEventArgs<CampaignInfo> | Occurs when a campaign is launched (whether it was originally scheduled or launched directly). |
CampaignUTMChanged | Execute | CMSEventArgs<CampaignUTMChangedEventArgs> | Occurs when the UTM parameter is changed for a campaign. |
Namespace: CMS.ContactManagement
Event | Event types | Handler parameters | Description |
|---|---|---|---|
ContactInfosDeleted | Execute | ContactinfosDeletedHandlerEventArgs Properties
| Occurs when two or more selected contacts are deleted. When a single contact is deleted, the TypeInfoEvents.Delete event can be used on ContactInfo.TYPEINFO. |
Namespace: CMS.Activities
Event | Event types | Handler parameters | Description |
|---|---|---|---|
ActivityBulkInsertPerformed | Before | CMSEventArgs<IList<IActivityInfo>> | Fires when the system processes on-line marketing activities that are logged in memory, and bulk inserts them to the database. |
ActivityProcessedInLogService | Execute | CMSEventArgs<IActivityInfo> | Fires when an on-line marketing activity is logged and processed. At this point, the activity is only stored in the application memory (activities are regularly processed and saved in bulk to the database – see the ActivityBulkInsertPerformed event). |
Namespace: CMS.Automation
Contains events related to marketing automation actions.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
MoveToNextStep | Before | AutomationEventArgs Properties
| Occurs when an automation process moves to the next step. |
MoveToPreviousStep | Before | AutomationEventArgs Properties
| Occurs when an automation process moves back to the previous step. |
Action | Before | WorkflowActionEventArgs<BaseInfo, AutomationStateInfo, AutomationActionEnum> Requires references to:
| Occurs when the system executes a marketing automation action step. |
ProcessTrigger | Before | AutomationProcessTriggerEventArgs Properties
| Occurs when processing triggers for automation processes. The system evaluates triggers periodically in bulk for a certain number of related contacts (represented by the collection in the Options property of the AutomationProcessTriggerEventArgs parameter). Evaluates the trigger condition and allows you to, for example, insert data into the condition. |
Namespace: CMS.OutputFilter
Contains events related to output filters.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
SaveOutputToCache | Before | OutputCacheEventArgs Properties
| Fires when an output filter saves the output to the cache. |
SendCacheOutput | Before | OutputCacheEventArgs Properties
| Fires before content from the output cache is sent as a response. Occurs only if the cached output is found, and if the cached output gives an opportunity to the user to change the output or to bypass caching entirely. |
CurrentFilter.OnBeforeFiltering |
| Fires before output filtering occurs. See Making custom modifications to output HTML. | |
CurrentFilter.OnAfterFiltering |
| Fires after output filtering occurs. See Making custom modifications to output HTML. | |
Namespace: CMS.URLRewritingEngine
Contains events related to URL rewriting and page redirection.
Note: URLRewritingEvents are only raised for sites built using the Portal Engine development model.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
PageNotFound | Execute | URLRewriterPageNotFoundEventArgs Properties
| Occurs when the system redirects users to a Page not found error page (after requesting a URL that returns a 404 HTTP status code). |
ProcessRewritingResult | Before | URLRewritingEventArgs Properties
| Occurs at the end of the rewriting process for all URLs. If there are redirects during the rewriting, the event is only triggered for the final URL at the end of the process. Use the Before event if you need to perform custom rewriting. To avoid the default rewriting steps, set the URLRewritingEventArgs.Parameters.Status property to RequestStatusEnum.PathRewritten. Use the After event to perform additional custom actions after the default rewriting. |
ProcessABTest | Execute | ProcessABTestEventArgs Properties
| Occurs when the system starts rewriting the URL of a page with a running A/B test. |
Namespace: CMS.Base
Contains general system events.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Exception | Execute | SystemEventArgs Properties
| Fires when an unhandled exception occurs in the system. |
Namespace: CMS.SiteProvider
Contains events related to site actions.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Delete | Before | SiteDeletionEventArgs Properties
| Occurs when a site is deleted from the system. |
Namespace: CMS.DataEngine
Contains events related to the execution of queries and other database operations.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
BulkInsert | Before | BulkInsertDataEventArgs Properties
| Occurs when the system creates objects by directly inserting data into a database table (for example when importing contacts from CSV files). |
ExecuteQuery | Before | ExecuteQueryEventArgs<DataSet> Properties
| Occurs when the system executes a database query. See also: Working with database queries in the API |
ExecuteNonQuery | Before | ExecuteQueryEventArgs<int> Properties
| Occurs when the system executes a non-query database operation. |
ExecuteScalar | Before | ExecuteQueryEventArgs<object> Properties
| Occurs when the system executes a scalar query. |
ExecuteReader | Before | ExecuteQueryEventArgs<[DbDataReader](http://msdn.microsoft.com/en-us/library/system.data.common.dbdatareader%28v=vs.100%29.aspx)> Properties
| Occurs when the system runs a database DataReader. |
Kentico provides a set of events that you can use to customize the global behavior of the application.
Namespace: CMS.Base
Contains events related to the application life cycle.
The following table lists the events that occur once in the application's life cycle, in order of execution:
Event | Event types | Handler parameters | Description |
|---|---|---|---|
PreInitialized | Execute | EventArgs (opens in a new tab) | Occurs when the application finishes pre-initialization (preparation of things unrelated to the database). Handlers need to be assigned in the PreInit method of custom modules. |
Initialized | Execute | EventArgs (opens in a new tab) | Occurs when the application finishes initialization and starts (including all modules and the database connection). Handle this event to perform standard application start events. |
PostStart | Execute | EventArgs (opens in a new tab) | Occurs at the end of the first application request. Allows you to perform asynchronous tasks needed for application startup. Running long operations within this event's handlers can negatively affect the response time of the first request when starting the application. |
End | Execute | EventArgs (opens in a new tab) | Occurs when the application ends. |
The following events occur as needed during the application life cycle:
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Error | Execute | EventArgs (opens in a new tab) | Fires when an error occurs in the application. |
SessionStart | Execute | EventArgs (opens in a new tab) | Occurs when an HTTP session starts for a client. |
SessionEnd | Execute | EventArgs (opens in a new tab) | Occurs when an HTTP session ends for a client. May not be raised if the application is configured to use a session state mode different than InProc. |
GetVaryByCustomString | Execute | GetVaryByCustomStringEventArgs Properties
| Occurs when the application processes variables in custom names of output cache keys. |
Namespace: CMS.Base
Contains events related to handling of requests. See also: ASP.NET Application Life Cycle Overview (opens in a new tab)
The following table lists the request events in order of execution:
Event | Event types | Handler parameters | Description |
|---|---|---|---|
Prepare | Execute | EventArgs (opens in a new tab) | Occurs before the request processing begins. |
Begin | Execute | EventArgs (opens in a new tab) | Occurs when the request processing starts. |
Authenticate | Execute | EventArgs (opens in a new tab) | Occurs when authenticating requests. |
Authorize | Execute | EventArgs (opens in a new tab) | Occurs when authorizing requests. If the application loads the response from the output cache, the life cycle skips to the End event. |
PostAuthorize | Execute | EventArgs (opens in a new tab) | Occurs after the request's user is authorized. |
PostResolveRequestCache | Execute | EventArgs (opens in a new tab) | Occurs when ASP.NET bypasses execution of the current handler and allows a caching module to serve the request from the cache. Not used by the Kentico output caching (see the Authorize event). The system performs URL rewriting during the event. After this event, the application can access the context of the displayed page and current page (page info). |
MapRequestHandler | Execute | EventArgs (opens in a new tab) | Occurs when a handler is selected to respond to the request. |
PostMapRequestHandler | Execute | EventArgs (opens in a new tab) | Occurs after the application has mapped the request to the appropriate event handler. |
AcquireRequestState | Execute | EventArgs (opens in a new tab) | Occurs when acquiring the state (for example session state) that is associated with the current request. |
PostAcquireRequestState | Execute | EventArgs (opens in a new tab) | Occurs after the request state (for example session state) that is associated with the current request has been obtained. |
End | Execute | EventArgs (opens in a new tab) | Occurs at the end of the request processing. |
RunEndRequestTasks | Execute | EventArgs (opens in a new tab) | Allows you to execute background tasks at the end of the request processing. Running long tasks in this event's handlers can negatively affect the response time of requests. |
Finalize | Execute | EventArgs (opens in a new tab) | Occurs when the request is finalized. Use to cleanup and release any resources used by the request. Running long tasks in this event's handlers can negatively affect the response time of requests. |
Handling other HttpApplication events
If you wish to handle HttpApplication events that are not available in the Kentico RequestEvents class, you need to create and register a custom HTTP module. You can implement the module in the App_Code folder of web site projects or as part of a custom assembly.
See Walkthrough: Creating and Registering a Custom HTTP Module (opens in a new tab) for more information.
Namespace: CMS.Membership
Contains events related to session management.
Event | Event types | Handler parameters | Description |
|---|---|---|---|
UpdateSession | Before | CMSEventArgs | Occurs when an HTTP session is updated. |
UpdateSessionData | Execute | CMSEventArgs<SessionInfo> Properties
| Occurs when the data of an HTTP session is updated. |
You can handle events related to the life cycle of pages and controls. The events are defined directly in the base classes of system pages and controls. You can leverage the events to customize the user interface. The events are direct delegates.
Namespace: CMS.Base.Web.UI
Contains events that occur during the user control life cycle.
Event | Handler parameter | Handler return type |
|---|---|---|
OnBeforeUserControlInit | EventArgs (opens in a new tab) | bool |
OnAfterUserControlInit | EventArgs (opens in a new tab) | void |
OnBeforeUserControlLoad | EventArgs (opens in a new tab) | bool |
OnAfterUserControlLoad | EventArgs (opens in a new tab) | void |
OnBeforeUserControlPreRender | EventArgs (opens in a new tab) | bool |
OnAfterUserControlPreRender | EventArgs (opens in a new tab) | void |
OnBeforeUserControlRender | HtmlTextWriter (opens in a new tab) | bool |
OnAfterUserControlRender | HtmlTextWriter (opens in a new tab) | void |
Return true in Before handlers to perform the default system actions for the given event.
Namespace: CMS.UIControls
Contains events that occur during the system page life cycle.
Event | Handler parameter | Handler return type |
|---|---|---|
OnBeforePagePreInit | EventArgs (opens in a new tab) | bool |
OnAfterPagePreInit | EventArgs (opens in a new tab) | void |
OnBeforePageInit | EventArgs (opens in a new tab) | bool |
OnAfterPageInit | EventArgs (opens in a new tab) | void |
OnBeforePageLoad | EventArgs (opens in a new tab) | bool |
OnAfterPageLoad | EventArgs (opens in a new tab) | void |
OnBeforePagePreRender | EventArgs (opens in a new tab) | bool |
OnAfterPagePreRender | EventArgs (opens in a new tab) | void |
OnBeforePageRender | HtmlTextWriter (opens in a new tab) | bool |
OnAfterPageRender | HtmlTextWriter (opens in a new tab) | void |
Return true in Before handlers to perform the default system actions for the given event.