session in asp.net is getting close after 2-3 minutes - asp.net

I have made a web application which uses user authentication and if user is authenticated user then i store it in Session like below.
Session("uid") = txtUid.text
But after 2-3 minutes Session is automatically cleared.

increase your session time in Web.config
<system.web>
<sessionState timeout="260" />
</system.web>

2 - 3 minutes?
it means that you are not sure how long it takes for the session to close.
from here i can assume that you are using internet explorer?
internet explorer has a known issue with asp.net, if you have an underscore in your virtual path like
www.mySite.com/some_test_site.aspx
so i bet you have a scenario like this.
in any case, you can add the following line to your web.config to keep vars for 60 minutes:
<sessionState mode="InProc" timeout="60"/>
it goes under:
<configuration>
<system.web>

You can set the session state of your web application in web.config. Add this code in the Configuration section of your web.config.
<configuration>
<system.web>
...
<sessionState timeout="20" />
...
</system.web>
</configuration>

Related

session timeout configuration in Web.config

I am new to .net and MVC framework of it as well.
I need to create session timeout functionality.
So I tried
<system.web>
<sessionState timeout="20"></sessionState>
</system.web>
I tried mode="InProc" as well with no luck.
I already has this line in Web.Config
<sessionState timeout="30"
mode="SQLServer"
cookieName="SafeAuto.QuoteAndPurchase"
sqlConnectionString="Data Source=CORPSQLTS09RM18;user id=webuser;password=M#r3Bar!"
cookieless="false"
regenerateExpiredSessionId="true" />
And I know we can not use 2 times.
So anybody has anything in mind to help me out over here. In addition, after session timeout I want to redirect page to specific page.

Extend Session Expiry Time

I am running a discussion website. The problem that is coming is that after sometime session automatically expires. I am hosting my website on a shared server and doesn't have access to the settings of extending expiry time in IIS. So is there any way I can do that using web.config?
And also I enabled basic authentication on the server and using default authentication in my website, means I didn't gave any authentication mode in configuration file. So are they same?
Yes, this is possible:
<configuration>
<system.web>
<sessionState timeout="x" />
<system.web>
</configuration>
Where x is the desired session timeout in minutes.
You can manage session timeout using web.config
Sessionstate timeout property is mentioned in minutes.
In webconfig file...
<system.web>
<sessionState timeout="1440"></sessionState>
</system.web>

Session Time Out in Asp.net 4.0 on IIS 7.5

I want to set timeout for my web application for 12 hours.
I have done setting in web.config file as:
<system.web>
<sessionState timeout="720" />
</system.web>
As suggested in the following post:
I came to know that the Application Pool recycles in every 20 minutes (if the pool is ideal).
And I also checked for changing the application pool time out using one question about application pool timeout setting
But still the session time-out is not set to 720 minutes. Do I need to change machine.config file for changing the session time out.
But I think the properties of machine.config file should be overriden by web.config file.
Kindly provide me some idea.
You can try out WMI(Windows Management Instrumentation) script it can help you.You need to have sufficient priveleges to implement the Script.
follwing are the links you can check to get more information.
http://bendera.blogspot.in/2010/12/configuring-ica-rdp-timeout-values.html
http://technet.microsoft.com/en-us/library/cc771956%28v=ws.10%29.aspx
You should set all following:
Application Pool / Advanced Settings. There the option Idle Timeout should be set in minutes.
Then within the web.config file in system.web section you should also set the Authentication/Forms, SessionState and RoleManager timeouts, if applicable.
<authentication mode="Forms"><forms loginUrl="~/default.aspx" name=".ASPXFORMSAUTH" timeout="120" /></authentication>
<sessionState cookieless="AutoDetect" cookieName="TYS_ADMIN_SessionId" timeout="120" />
<roleManager ... cookieTimeout="120" defaultProvider="GMRoleProvider" enabled="true">...</roleManager>

Moved from iis6 to 7.5 asp.net session timeouts

After moving over to the new platform the site is logging people out after a time of inactivity. This never used to happen and I wish to set the timeout to a larger value. I've changed some settings to no effect and even in code the session.timeout is set to 1440.
Any ideas where I can find another setting for it or where I might start with this problem.
Thanks
The app pool was recycling as the worker process was set to expire after 20 minutes of inactivity.
Have a look at IIS session information here: HttpSessionState.Timeout Property
<configuration>
<system.web>
<sessionState
mode="InProc"
cookieless="true"
timeout="30" />
</system.web>
</configuration>
You can add this section to your web.config in your website root dir for authentication:
<system.web>
<authentication mode="Forms">
<forms timeout="1440" slidingExpiration="true"/>
</authentication>
</system.web>
Assuming that you're using Forms authentication.
And this for session timeout:
<system.web>
<sessionState timeout="1440"/>
<system.web>

Session Timeout extend in Asp.Net

How to extend the session timeout?
I tried entering:
Session.Timeout = 720;
In formLoad and also tried in webconfig:
<system.web>
<sessionState
mode="InProc"
cookieless="true"
timeout="720" />
</system.web>
But still it times out after 10 minutes. Can anyone help about this issue?
Take a look at this Microsoft Technet article. Check if it suits your needs.
<configuration>
<system.web>
<sessionState
cookieless="true"
timeout="20">
</sessionState>
</system.web>
</configuration>
You might see this article, I haven't used it but a time ago I needed something like this to use in a webservice and I finished with another approach. It could be useful to you:
The Defibrillator: Keeping ASP.NET Session Alive Ad Infinitum

Resources