SessionStateActions 枚举


标识数据存储区中的会话项是否用于需要初始化的会话。Identifies whether a session item from a data store is for a session that requires initialization.

此枚举有一个 FlagsAttribute 属性,允许按位组合成员值。

public enum class SessionStateActions
public enum SessionStateActions
type SessionStateActions = 
Public Enum SessionStateActions


InitializeItem 1

数据存储区中的会话项用于需要初始化的会话。The session item from the data store is for a session that requires initialization.

None 0

不需要通过调用代码来执行任何初始化操作。No initialization actions need to be performed by the calling code.


有关使用SessionStateActions枚举的会话状态存储提供程序实现的示例, 请参阅实现会话状态存储提供程序For an example of a session-state store provider implementation that uses the SessionStateActions enumeration, see Implementing a Session-State Store Provider.


枚举由实现SessionStateStoreProviderBaseGetItemGetItemExclusive方法使用。 SessionStateActionsThe SessionStateActions enumeration is used by the GetItem and GetItemExclusive methods of a SessionStateStoreProviderBase implementation. 从数据存储中检索会话项时, 枚举值指示会话是否需要初始化, 或者不基于存储在数据中的值。When a session item is retrieved from the data store, the enumeration value indicates whether the session requires initialization or not based on a value stored with the data. 和方法根据使用会话actions项检索到SessionStateActions的值将参数设置为枚举值。 GetItemExclusive GetItemThe GetItem and GetItemExclusive methods set an actions parameter to a SessionStateActions enumeration value based on this value retrieved with the session item. 如果将actions参数的值设置为 InitializeItem, 则SessionStateModule会初始化会话, 并执行 ASP.NET 应用Session_OnStart程序的 global.asax 文件中定义的事件。If the value of the actions parameter is set to InitializeItem, the SessionStateModule initializes the session and executes the Session_OnStart event defined in the Global.asax file for the ASP.NET application. 如果actions参数的值为 "无", 则不会为当前会话执行其他步骤。If the value of the actions parameter is None, no additional steps are taken for the current session.

通过CreateUninitializedItem方法创建的会话项是使用值创建的, 该值指示该项需要初始化, GetItem actions且和GetItemExclusive方法应将参数设置为 InitializeItem。A session item created by the CreateUninitializedItem method is created with a value indicating that the item requires initialization and that the GetItem and GetItemExclusive methods should set the actions parameter to InitializeItem.