How do I set a session timer / timeout in C# codebehind?

Posted on 2014-09-25
Last Modified: 2014-10-06
Are there any examples that I can see here or be pointed to to show how to set the session timeout for my web application in the code behind? (C#)?
Question by:mikesExpertExchange
  • 2
LVL 25

Expert Comment

Comment Utility
You can set the timeout in the web.config or in the code. Please see more details in this link,

Author Comment

Comment Utility
@apeter: that shows me and example for the web.config and that helps. I also need an example in C#?
LVL 78

Accepted Solution

David Johnson, CD, MVP earned 500 total points
Comment Utility
int iTimeout = 10; // 10 minutes
HttpSessionState.Timeout  = iTimeout;

Author Closing Comment

Comment Utility
Thank you.

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now