Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hi....friends

-i want to give session time 30 minites so in any user and admin login and then after 30 minites his session is expire and need to relogin so how can i implement this task in global.asax

-i here about Session_Start to perform this task is it right way?????
Posted

you can do using Web.Config file. there are three type of Session as below, you have to add below section into web.config

1)InProc
HTML
<sessionstate mode="InProc" cookieless="true" timeout="30" />

2)StateServer
HTML
<sessionstate mode="StateServer" stateconnectionstring="tcpip=SampleStateServer:42424" cookieless="false" timeout="30" />

3)SQLServer
HTML
<sessionstate mode="SQLServer" sqlconnectionstring="Integrated Security=SSPI;data source=SampleSqlServer;" />


session will expire automatically when user is idle for 30 min
 
Share this answer
 
Try this one in web config:
XML
<system.web>
    <sessionState timeout="60" />
</system.web>
 
Share this answer
 
Comments
bhavesh002 28-Feb-12 7:04am    
thanks
but,
time out is in which unit???
minites or Second????
Harshad-HBK 28-Feb-12 7:11am    
It's in seconds.
Dhol Gaurav 28-Feb-12 7:20am    
@ harshad it's not is second it's in Minits
Harshad-HBK 28-Feb-12 7:37am    
Gaurav thanks for correcting me...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900