共用方式為


IHttpSessionState.Timeout 屬性

定義

取得或設定在工作階段狀態提供者終止工作階段前,要求之間允許的逾時期間 (以分鐘為單位)。

public:
 property int Timeout { int get(); void set(int value); };
public int Timeout { get; set; }
member this.Timeout : int with get, set
Public Property Timeout As Integer

屬性值

逾時期限 (以分鐘為單位)。

範例

下列程式代碼範例會 Timeout 實作 介面的 IHttpSessionState 屬性,以取得並設定會話逾時值,該值儲存在類別建構函式中建立的內部變數中。

public int Timeout
{
  get { return pTimeout; }
  set
  {
    if (value <= 0)
      throw new ArgumentException("Timeout value must be greater than zero.");

    if (value > MAX_TIMEOUT)
      throw new ArgumentException("Timout cannot be greater than " + MAX_TIMEOUT.ToString());

    pTimeout = value;
  }
}
Public Property Timeout As Integer Implements IHttpSessionState.Timeout
  Get
    Return pTimeout
  End Get
  Set
    If value <= 0 Then _
      Throw New ArgumentException("Timeout value must be greater than zero.")

    If value > MAX_TIMEOUT Then _
      Throw New ArgumentException("Timout cannot be greater than " & MAX_TIMEOUT.ToString())

    pTimeout = value
  End Set
End Property

適用於

另請參閱