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

适用于

另请参阅