Try our conversational search powered by Generative AI!

Class SessionStartCookieCriterionBase<T>

An abstract class for a coockie based visitor group criterion using strongly typed settings and automatically generated user interface On session start, a cookie will be created if it's not exist, and the value of the cookie will be set by the implementation

Inheritance
System.Object
SessionStartCookieCriterionBase<T>
Namespace: EPiServer.Personalization.VisitorGroups
Assembly: EPiServer.Framework.AspNetCore.dll
Version: 12.0.3
Syntax
public abstract class SessionStartCookieCriterionBase<T> : CriterionBase<T>, ICriterion, IGeneratesAdministrativeInterface where T : class, ICriterionModel, new()
Type Parameters
Name Description
T

Constructors

SessionStartCookieCriterionBase()

Creates a new instance of SessionStartCookieCriterionBase

Declaration
public SessionStartCookieCriterionBase()

Fields

_validCookieKey

Holder for cookie key

Declaration
protected string _validCookieKey
Field Value
Type Description
System.String

Properties

CookieExpires

Gets the cookie expires date and time for the cookie. If not override, the value will be DateTime.MinValue

Declaration
protected virtual DateTime CookieExpires { get; }
Property Value
Type Description
System.DateTime

The cookie expires.

CookieKey

Gets the cookie key.

Declaration
public abstract string CookieKey { get; }
Property Value
Type Description
System.String

The cookie key.

Methods

GetCookie(HttpContext)

Gets the cookie.

Declaration
protected string GetCookie(HttpContext httpContext)
Parameters
Type Name Description
Microsoft.AspNetCore.Http.HttpContext httpContext

The HTTP context.

Returns
Type Description
System.String

SetCookieValue(String, HttpContext)

Sets the cookie value.

Declaration
protected abstract void SetCookieValue(string cookieValue, HttpContext httpContext)
Parameters
Type Name Description
System.String cookieValue
Microsoft.AspNetCore.Http.HttpContext httpContext

Subscribe(ICriterionEvents)

Called when a criteria instance is initialized. Starts listenen on session start

Declaration
public override void Subscribe(ICriterionEvents criterionEvents)
Parameters
Type Name Description
ICriterionEvents criterionEvents

The criterion notifier.

Overrides
EPiServer.Personalization.VisitorGroups.CriterionBase<T>.Subscribe(EPiServer.Personalization.VisitorGroups.ICriterionEvents)
Remarks

Any event subscribed to in this method should be unsubscribed in method Unsubscribe. The reason for this is that otherwise there will be "dangling" event handlers.

Unsubscribe(ICriterionEvents)

Called when a criteria is unloaded, for example because it seetings has been updated. Unsubscribes the session start handler

Declaration
public override void Unsubscribe(ICriterionEvents criterionEvents)
Parameters
Type Name Description
ICriterionEvents criterionEvents
Overrides
EPiServer.Personalization.VisitorGroups.CriterionBase<T>.Unsubscribe(EPiServer.Personalization.VisitorGroups.ICriterionEvents)

Implements

Extension Methods