HttpSessionStateBase 类

定义

用作一些类的基类,可提供对会话状态值、会话级别设置以及生存期管理方法的访问。Serves as the base class for classes that provides access to session-state values, session-level settings, and lifetime management methods.

public ref class HttpSessionStateBase abstract : System::Collections::ICollection
public abstract class HttpSessionStateBase : System.Collections.ICollection
type HttpSessionStateBase = class
    interface ICollection
    interface IEnumerable
Public MustInherit Class HttpSessionStateBase
Implements ICollection
继承
HttpSessionStateBase
派生
实现

注解

类是一个抽象类, 它包含与HttpSessionState类相同的成员。 HttpSessionStateBaseThe HttpSessionStateBase class is an abstract class that contains the same members as the HttpSessionState class. 利用类, 您可以创建HttpSessionState类似于类的派生类, 但可以自定义该派生类并在 ASP.NET 管道之外工作。 HttpSessionStateBaseThe HttpSessionStateBase class enables you to create derived classes that are like the HttpSessionState class, but that you can customize and that work outside the ASP.NET pipeline. 执行单元测试时, 通常使用派生类来实现具有自定义行为的成员, 该行为可满足你要测试的方案。When you perform unit testing, you typically use a derived class to implement members with customized behavior that fulfills the scenario you are testing.

HttpSessionStateWrapper 类是从 HttpSessionStateBase 类派生的。The HttpSessionStateWrapper class derives from the HttpSessionStateBase class. 类用作HttpSessionState类的包装。 HttpSessionStateWrapperThe HttpSessionStateWrapper class serves as a wrapper for the HttpSessionState class. 在运行时, 通常使用HttpSessionStateWrapper类的实例来调用HttpSessionState对象的成员。At run time, you typically use an instance of the HttpSessionStateWrapper class to call members of the HttpSessionState object.

构造函数

HttpSessionStateBase()

初始化该类供继承的类实例使用。Initializes the class for use by an inherited class instance. 此构造函数只能由继承的类调用。This constructor can only be called by an inherited class.

属性

CodePage

当在派生类中重写时,获取或设置当前会话的字符集标识符。When overridden in a derived class, gets or sets the character-set identifier for the current session.

Contents

在派生类中重写时,获取对当前会话状态对象的引用。When overridden in a derived class, gets a reference to the current session-state object.

CookieMode

在派生类中重写时,获取一个值,该值指示是否为无 Cookie 会话配置应用程序。When overridden in a derived class, gets a value that indicates whether the application is configured for cookieless sessions.

Count

当在派生类中重写时,获取会话状态集合中的项数。When overridden in a derived class, gets the number of items in the session-state collection.

IsCookieless

在派生类中重写时,获取一个值,该值指示会话 ID 是否嵌入在 URL 中。When overridden in a derived class, gets a value that indicates whether the session ID is embedded in the URL.

IsNewSession

在派生类中重写时,获取一个值,该值指示会话是否是在当前请求过程中创建的。When overridden in a derived class, gets a value that indicates whether the session was created during the current request.

IsReadOnly

在派生类中重写时,获取一个值,该值指示会话是否为只读。When overridden in a derived class, gets a value that indicates whether the session is read-only.

IsSynchronized

在派生类中重写时,获取一个值,该值指示对会话状态值集合的访问是否是同步的(线程安全)。When overridden in a derived class, gets a value that indicates whether access to the collection of session-state values is synchronized (thread safe).

Item[Int32]

在派生类中重写时,通过使用指定的索引获取或设置会话值。When overridden in a derived class, gets or sets a session value by using the specified index.

Item[String]

在派生类中重写时,通过使用指定的名称获取或设置会话值。When overridden in a derived class, gets or sets a session value by using the specified name.

Keys

在派生类中重写时,获取存储在会话状态集合中的所有值的密钥集合。When overridden in a derived class, gets a collection of the keys for all values that are stored in the session-state collection.

LCID

在派生类中重写时,获取或设置当前会话的区域设置标识符 (LCID)。When overridden in a derived class, gets or sets the locale identifier (LCID) of the current session.

Mode

在派生类中重写时,获取当前会话状态模式。When overridden in a derived class, gets the current session-state mode.

SessionID

在派生类中重写时,获取会话的唯一标识符。When overridden in a derived class, gets the unique identifier for the session.

StaticObjects

在派生类中重写时,获取由 object 元素声明的对象的集合,这些元素在应用程序的 Global.asax 文件中标记为服务器控件且范围限定为当前会话。When overridden in a derived class, gets a collection of objects that are declared by object elements that are marked as server controls and scoped to the current session in the application's Global.asax file.

SyncRoot

在派生类中重写时,获取一个对象,该对象可用于同步对会话状态值集合的访问。When overridden in a derived class, gets an object that can be used to synchronize access to the collection of session-state values.

Timeout

在派生类中重写时,获取和设置在会话状态提供程序结束会话之前在请求之间所允许间隔的时间量(以分钟为单位)。When overridden in a derived class, gets or sets the time, in minutes, that can elapse between requests before the session-state provider ends the session.

方法

Abandon()

当在派生类中被重写时,取消当前会话。When overridden in a derived class, cancels the current session.

Add(String, Object)

当在派生类中被重写时,向会话状态集合添加一个项。When overridden in a derived class, adds an item to the session-state collection.

Clear()

在派生类中重写时,从会话状态集合中移除所有键和值。When overridden in a derived class, removes all keys and values from the session-state collection.

CopyTo(Array, Int32)

当在派生类中重写时,从数组中指定索引处开始,将会话状态值集合复制到一维数组。When overridden in a derived class, copies the collection of session-state values to a one-dimensional array, starting at the specified index in the array.

Equals(Object)

确定指定的对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
GetEnumerator()

在派生类中重写时,返回一个枚举数,该枚举数可用于读取当前会话中的所有会话状态变量名称。When overridden in a derived class, returns an enumerator that can be used to read all the session-state variable names in the current session.

GetHashCode()

用作默认哈希函数。Serves as the default hash function.

(继承自 Object)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
Remove(String)

在派生类中重写时,从会话状态集合中删除一个项。When overridden in a derived class, deletes an item from the session-state collection.

RemoveAll()

在派生类中重写时,从会话状态集合中移除所有键和值。When overridden in a derived class, removes all keys and values from the session-state collection.

RemoveAt(Int32)

在派生类中重写时,从会话状态集合中删除位于指定索引处的项。When overridden in a derived class, deletes the item at the specified index from the session-state collection.

ToString()

返回一个表示当前对象的 string。Returns a string that represents the current object.

(继承自 Object)

扩展方法

Cast<TResult>(IEnumerable)

IEnumerable 的元素强制转换为指定的类型。Casts the elements of an IEnumerable to the specified type.

OfType<TResult>(IEnumerable)

根据指定类型筛选 IEnumerable 的元素。Filters the elements of an IEnumerable based on a specified type.

AsParallel(IEnumerable)

启用查询的并行化。Enables parallelization of a query.

AsQueryable(IEnumerable)

IEnumerable 转换为 IQueryableConverts an IEnumerable to an IQueryable.

适用于