Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello,

I have created a website in which i have declared session time in web.config. If the website is left idol for 4 mins its logging out I gave the time as 600 mins but still it logs out in 4 mins. I want to increase the session time I dont want the page to expire below 60 mins. Please help

XML
<sessionState mode="InProc" cookieless="false" timeout="600">
    </sessionState>
Posted
Updated 25-Jan-15 21:29pm
v5
Comments
InbarBarkai 25-Jan-15 1:02am    
Your question is unclear. Could you please elaborate a little?
sushma2607 26-Jan-15 3:26am    
if the website is ideal without use for 4 mins the session is killed it is asking credentials, so person has to login. i want the session to be alive for more than 60 mins. I have declared session time in web.congif file.
Afzaal Ahmad Zeeshan 26-Jan-15 5:07am    
Are you using WebSecurity class to log the user in, if so what are you passing as the rememberMe parameter? Is it true or false. Secondly, this is a flaw in ASP.NET's WebSecurity helper, each time the user leaves the website for a while, the cookie is removed or so, thus removing the logged in user account, and asking him to re-login.
Suvendu Shekhar Giri 26-Jan-15 6:15am    
Check the IIS Session time out value which may differ from this. The default value of session time out is 20 minutes.
_Asif_ 26-Jan-15 6:47am    
Yes, this could be the problem

1 solution

Try this:
XML
<sessionState mode="InProc" customProvider="DefaultSessionProvider" timeout="60">
      <providers>
        <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="DefaultConnection" />
      </providers>
    </sessionState>


Off course you need to have a connection named DefaultConnection.
 
Share this answer
 
v2
Comments
sushma2607 26-Jan-15 5:12am    
this is my connection string
add key="SqlConnection" value="Data Source=*****;Initial Catalog=****;User ID=**;Password=****"

in the above solution connectionStringName="DefaultConnection" should i give the entire value in default connection ??
InbarBarkai 26-Jan-15 5:28am    
Visual studio has a default connection string usually set.
if not you can add a new connection string or add a default like this:
<connectionstrings>
<add name="DefaultConnection" providername="System.Data.SqlClient" connectionstring="Data Source=TheLocationOfTheDatabase;Initial Catalog=TheNameOfTheDatabase;Integrated Security=True;"></add>
</connectionstrings>
sushma2607 26-Jan-15 6:06am    
Nope this is also not working
InbarBarkai 26-Jan-15 6:08am    
Try using your connection(instead of DefaultConnection use SqlConnection)
sushma2607 26-Jan-15 6:11am    
system.web

appSettings
add key="Provider" value="SQL" /
add key="SqlConnection" value="Data Source=162.222.225.88;Initial Catalog=Radikal;User ID=Tax;Password=Radikal@123" /

/appSettings
system.web
sessionState mode="InProc" customProvider="DefaultSessionProvider" timeout="60"
providers
add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" connectionStringName="LocalSqlServer" /
/providers
/sessionState
connectionStrings
remove name="LocalSqlServer" /
add name="DefaultConnection" providername="System.Data.SqlClient" connectionstring="Data Source=162.222.225.88;Initial Catalog=Radikal;uid=Tax;password=;Integrated Security=True;"
/add
/connectionStrings>


This is in my web.config file

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