I want to set the session timeout in code so it can come from a configurab开发者_运维技巧le value.
Can I just do this in global.asax?
Session.Timeout = value;
to change session timeout write this code in your web.config file
or you can also set this in global.asax file as
Session.Timeout = 60 ; // in Session.Start() event
it will increase your session expire time .
From the MSDN page describing the TimeOut property:
The Timeout property can be set in the Web.config file for an application using the timeout attribute of the sessionState configuration element, or you can set the Timeout property value directly using application code.
So yes, you can assign a value to this property and the Global.asax
is a good place to do this.
精彩评论