简体   繁体   中英

Is there a difference between setting Session.Timeout or adding it to the web.config?

In ASP.NET there are two ways of setting the session timeout.

In the code:

Session.Timeout = 20

or In web.config

<sessionState timeout="20"/>

But what I don't understand is the difference between the two forms.

Are there any?

The value in web.config is a (default) timeout value for all sessions. In code you are able to give specific sessions a different timeout.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM