共用方式為


SessionStateStoreProviderBase.SetAndReleaseItemExclusive 方法

定義

使用目前要求的值,更新工作階段狀態資料存放區中的工作階段項目資訊,並清除對資料的鎖定。

public:
 abstract void SetAndReleaseItemExclusive(System::Web::HttpContext ^ context, System::String ^ id, System::Web::SessionState::SessionStateStoreData ^ item, System::Object ^ lockId, bool newItem);
public abstract void SetAndReleaseItemExclusive (System.Web.HttpContext context, string id, System.Web.SessionState.SessionStateStoreData item, object lockId, bool newItem);
abstract member SetAndReleaseItemExclusive : System.Web.HttpContext * string * System.Web.SessionState.SessionStateStoreData * obj * bool -> unit
Public MustOverride Sub SetAndReleaseItemExclusive (context As HttpContext, id As String, item As SessionStateStoreData, lockId As Object, newItem As Boolean)

參數

context
HttpContext

目前要求的 HttpContext

id
String

目前要求的工作階段識別項。

item
SessionStateStoreData

SessionStateStoreData 物件,包含要儲存的目前工作階段值。

lockId
Object

目前要求的鎖定識別項。

newItem
Boolean

true 表示將工作階段項目識別為新項目,false 則表示將工作階段項目識別為現有項目。

範例

如需會話狀態存放區提供者實作的範例,請參閱 實作Session-State存放區提供者

備註

物件 SessionStateModuleSetAndReleaseItemExclusive 會在要求結束時呼叫 方法,在 事件期間 ReleaseRequestState 將目前的會話專案資訊插入資料存放區,或使用目前值更新資料存放區中的現有會話專案資訊、更新專案的到期時間,以及釋放資料的鎖定。 只會更新符合所提供會話和 lockId 值的目前應用程式的會話 id 資料。 如需鎖定的詳細資訊,請參閱類別概觀中的 SessionStateStoreProviderBase

如果目前要求的會話值尚未修改, SetAndReleaseItemExclusive 則不會呼叫 方法。 相反地,會 ReleaseItemExclusive 呼叫 方法。

Abandon如果已呼叫 方法, SetAndReleaseItemExclusive 則不會呼叫 方法。 相反地 SessionStateModule ,物件會呼叫 RemoveItem 方法,以從資料來源刪除會話專案資料。

適用於

另請參閱