Increase session timeout in ASP.NET by using this code. Put this code in web.config file.
<system.web>
<!-- Increase session timeout -->
<sessionState mode="InProc" stateConnectionString="tcpip=127.0.0.1:42424" cookieless="false"
timeout="120"/>
</system.web>
This will increase the session timeout to 120 min. By default session timeout is 20 min
or
<system.web>
<sessionState mode="StateServer" stateNetworkTimeout="10"
sqlCommandTimeout="30" cookieName="ASP.NET_SessionId" timeout="53200"
regenerateExpiredSessionId="False">
<providers>
<clear/>
</providers>
</sessionState>
<httpRuntime executionTimeout="9999" maxRequestLength="10240"/>
<machineKey validationKey="409B3A07F360A34A7C5DDD40B317AF7BBD7904A1E3D68273A9AC320BAE312D39619A28443AAF92E16A88BC66BF5AAF543C33723581EAD1378DEA9653C44868FC"
decryptionKey="EA09335756D695E538762FABB50FE581AFA525C4B485AC51E450D95DD813303E"
validation="SHA1" decryption="AES" />
</system.web>
Generate your Machine Key
it will be unique so generate your own key from the below link and
paste in web.config file
http://aspnetresources.com/tools/machineKey
in global.asax
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
// Code that runs when a new session is started
Session.Timeout = 53200;
}
good
ReplyDeleteHi Raj, but this is not working. Now what to do?
ReplyDeleteCan you send me your sample code at rajahuja10@gmail.com
ReplyDeletehello raj,
ReplyDeletei am using a shared server and i am having the problem in session time out as the default time of server session timeout is 20 min but i wants to keep session alive till he is logged in on the application.
can you please suggest me some solution for this problem
Use this code
DeleteGenerate your Machine Key
it will be unique so generate your own key from the below link and
paste in web.config file
http://aspnetresources.com/tools/machineKey
in global.asax
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
// Code that runs when a new session is started
Session.Timeout = 53200;
}
I read your blog.It’s very useful for me. I have some new idea to share with you .
ReplyDeleteSoftware training company in Ahmedabad
php training company in Ahmedabad
corporate training company in Ahmedabad
live project training in Ahmedabad
IT training company in Ahmedabad
professional training compay in ahmedabad
professional training institute in ahmedabad
best SEO training company in ahmedabad
final year project training in ahmedabad
php live project training in ahmedabad
professional training institute in ahmedabad
project training company in Ahmedabad
IT training courses in ahmedabad