HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback


This content applies to Optimizely Content Management System (CMS) versions 11.9.0 and higher.

You can use the built-in Optimizely visitor group criteria without requiring session state on the server side by manually disable ASP.NET session states. The visitor group system can autodetect if session state was disabled and switch to a cookie-based approach for visitor group criteria that previously used sessions. You can also customize your own storage of users' visitor group sessions.

### RaiseStartSession event

If the session is enabled, then the `RaiseStartSession` event is raised by `AspNet` session start event. If the session is disabled, then the `RaiseStartSession` event is raised by `HttpApplication` `AcquireRequestState` event.

### Session State

The session-based visitor group criterion saves its session state inside session, cookie, or customized state storage. If the session is enabled and there is no registered custom storage, then it uses http session object as storage. If the session is disabled and there is no registered custom storage, then it uses http cookie as storage.

### Enable and disabling session state

By default, the http session object is used if the `AspNet` session state mode is not **Off**. It can be changed explicitly by setting false the property `EnableSession` on the `VisitorGroupOptions` options.

### Customize State storage

To customize storage, it is needed to implement the `IStateStorage` interface and register it.

This sample code shows both customized state storage and disabling session state.

and the custom state storage can be registered in `IServiceCollection` in the startup, like this: