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

发布于 2024-07-19 07:12:59 字数 28 浏览 4 评论 0原文

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

祁梦 2024-07-26 07:12:59

MSDN 为 20 分钟

根据 微软软件定义网络:

可选的 TimeSpan 属性。

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

It is 20 Minutes according to MSDN

From 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.

铁轨上的流浪者 2024-07-26 07:12:59

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

请参阅HttpSessionState.Timeout 财产; 默认值为 20 分钟。

您可以通过 HttpContext 在 ASP.NET 中访问此属性:

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

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.

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

this.HttpContext.Session.Timeout // ASP.NET MVC controller
Page.Session.Timeout // ASP.NET Web Forms code-behind
HttpContext.Current.Session.Timeout // Elsewhere
淡淡の花香 2024-07-26 07:12:59
  1. 会话的默认过期时间为 20 分钟
  2. Cookie 的默认有效期为 30 分钟
  3. ViewState 的最大大小是页面大小的 25%
  1. The Default Expiration Period for Session is 20 Minutes.
  2. The Default Expiration Period for Cookie is 30 Minutes.
  3. Maximum Size of ViewState is 25% of Page Size
寄离 2024-07-26 07:12:59

默认值为 20 分钟。
http://msdn.microsoft.com/en-我们/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>

The default is 20 minutes.
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>
我不吻晚风 2024-07-26 07:12:59

会话的默认过期时间为 20 分钟。

您可以更新会话状态并配置超时下的分钟数

<sessionState 
timeout="30">
</sessionState>

The Default Expiration Period for Session is 20 Minutes.

You can update sessionstate and configure the minutes under timeout

<sessionState 
timeout="30">
</sessionState>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文