ASP.NET中的默认会话超时是什么?

时间:2022-08-11 01:39:16

What is the default session timeout value in ASP.NET?

ASP.NET中的默认会话超时值是多少?

5 个解决方案

#1


97  

It is 20 Minutes according to MSDN

根据MSDN,是20分钟

From MSDN:

从MSDN:

Optional TimeSpan attribute.

可选的时间间隔属性。

Specifies the number of minutes a session can be idle before it is abandoned. The timeout attribute cannot be set to a value that is greater than 525,601 minutes (1 year) for the in-process and state-server modes. The session timeout configuration setting applies only to ASP.NET pages. Changing the session timeout value does not affect the session time-out for ASP pages. Similarly, changing the session time-out for ASP pages does not affect the session time-out for ASP.NET pages. The default is 20 minutes.

指定一个会话在被放弃之前可以空闲的分钟数。对于进程内和状态服务器模式,超时属性不能设置为大于525,601分钟(1年)的值。会话超时配置设置只适用于ASP。网络页面。更改会话超时值不会影响ASP页面的会话超时。类似地,更改ASP页面的会话超时不会影响ASP的会话超时。网络页面。默认是20分钟。

#2


42  

It depends on either the configuration or programmatic change.
Therefore the most reliable way to check the current value is at runtime via code.

它取决于配置或编程更改。因此,最可靠的检查当前值的方法是在运行时通过代码。

See the HttpSessionState.Timeout property; default value is 20 minutes.

看到HttpSessionState。超时属性;默认值是20分钟。

You can access this propery in ASP.NET via HttpContext:

您可以在ASP中访问这个属性。NET通过HttpContext:

this.HttpContext.Session.Timeout // ASP.NET MVC controller
Page.Session.Timeout // ASP.NET Web Forms code-behind
HttpContext.Current.Session.Timeout // Elsewhere

#3


26  

  1. The Default Expiration Period for Session is 20 Minutes.
  2. 会话的默认过期时间是20分钟。
  3. The Default Expiration Period for Cookie is 30 Minutes.
  4. Cookie的默认过期时间是30分钟。
  5. Maximum Size of ViewState is 25% of Page Size
  6. ViewState的最大大小为页面大小的25%。

#4


20  

The default is 20 minutes. http://msdn.microsoft.com/en-us/library/h6bb9cz9(v=vs.80).aspx

默认是20分钟。http://msdn.microsoft.com/en-us/library/h6bb9cz9(v = vs.80). aspx

<sessionState 
mode="[Off|InProc|StateServer|SQLServer|Custom]"
timeout="number of minutes"
cookieName="session identifier cookie name"
cookieless=
     "[true|false|AutoDetect|UseCookies|UseUri|UseDeviceProfile]"
regenerateExpiredSessionId="[True|False]"
sqlConnectionString="sql connection string"
sqlCommandTimeout="number of seconds"
allowCustomSqlDatabase="[True|False]"
useHostingIdentity="[True|False]"
stateConnectionString="tcpip=server:port"
stateNetworkTimeout="number of seconds"
customProvider="custom provider name">
<providers>...</providers>
</sessionState>

#5


0  

You can use sessionstate and configure the minutes under timeout

您可以使用sessionstate并在超时下配置分钟。

<sessionState 
timeout="20" 
</sessionState>

#1


97  

It is 20 Minutes according to MSDN

根据MSDN,是20分钟

From MSDN:

从MSDN:

Optional TimeSpan attribute.

可选的时间间隔属性。

Specifies the number of minutes a session can be idle before it is abandoned. The timeout attribute cannot be set to a value that is greater than 525,601 minutes (1 year) for the in-process and state-server modes. The session timeout configuration setting applies only to ASP.NET pages. Changing the session timeout value does not affect the session time-out for ASP pages. Similarly, changing the session time-out for ASP pages does not affect the session time-out for ASP.NET pages. The default is 20 minutes.

指定一个会话在被放弃之前可以空闲的分钟数。对于进程内和状态服务器模式,超时属性不能设置为大于525,601分钟(1年)的值。会话超时配置设置只适用于ASP。网络页面。更改会话超时值不会影响ASP页面的会话超时。类似地,更改ASP页面的会话超时不会影响ASP的会话超时。网络页面。默认是20分钟。

#2


42  

It depends on either the configuration or programmatic change.
Therefore the most reliable way to check the current value is at runtime via code.

它取决于配置或编程更改。因此,最可靠的检查当前值的方法是在运行时通过代码。

See the HttpSessionState.Timeout property; default value is 20 minutes.

看到HttpSessionState。超时属性;默认值是20分钟。

You can access this propery in ASP.NET via HttpContext:

您可以在ASP中访问这个属性。NET通过HttpContext:

this.HttpContext.Session.Timeout // ASP.NET MVC controller
Page.Session.Timeout // ASP.NET Web Forms code-behind
HttpContext.Current.Session.Timeout // Elsewhere

#3


26  

  1. The Default Expiration Period for Session is 20 Minutes.
  2. 会话的默认过期时间是20分钟。
  3. The Default Expiration Period for Cookie is 30 Minutes.
  4. Cookie的默认过期时间是30分钟。
  5. Maximum Size of ViewState is 25% of Page Size
  6. ViewState的最大大小为页面大小的25%。

#4


20  

The default is 20 minutes. http://msdn.microsoft.com/en-us/library/h6bb9cz9(v=vs.80).aspx

默认是20分钟。http://msdn.microsoft.com/en-us/library/h6bb9cz9(v = vs.80). aspx

<sessionState 
mode="[Off|InProc|StateServer|SQLServer|Custom]"
timeout="number of minutes"
cookieName="session identifier cookie name"
cookieless=
     "[true|false|AutoDetect|UseCookies|UseUri|UseDeviceProfile]"
regenerateExpiredSessionId="[True|False]"
sqlConnectionString="sql connection string"
sqlCommandTimeout="number of seconds"
allowCustomSqlDatabase="[True|False]"
useHostingIdentity="[True|False]"
stateConnectionString="tcpip=server:port"
stateNetworkTimeout="number of seconds"
customProvider="custom provider name">
<providers>...</providers>
</sessionState>

#5


0  

You can use sessionstate and configure the minutes under timeout

您可以使用sessionstate并在超时下配置分钟。

<sessionState 
timeout="20" 
</sessionState>