Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2014-09-25
4
Medium Priority
?
2,550 Views
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#)?
0
Comment
Question by:Michael Sterling
  • 2
4 Comments
 
LVL 25

Expert Comment

by:apeter
ID: 40346825
You can set the timeout in the web.config or in the code. Please see more details in this link, http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.timeout(v=vs.110).aspx
0
 
LVL 1

Author Comment

by:Michael Sterling
ID: 40346880
@apeter: that shows me and example for the web.config and that helps. I also need an example in C#?
0
 
LVL 84

Accepted Solution

by:
David Johnson, CD, MVP earned 2000 total points
ID: 40348109
int iTimeout = 10; // 10 minutes
HttpSessionState.Timeout  = iTimeout;
0
 
LVL 1

Author Closing Comment

by:Michael Sterling
ID: 40364097
Thank you.
0

Featured Post

Configuration Guide and Best Practices

Read the guide to learn how to orchestrate Data ONTAP, create application-consistent backups and enable fast recovery from NetApp storage snapshots. Version 9.5 also contains performance and scalability enhancements to meet the needs of the largest enterprise environments.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
Loops Section Overview
Suggested Courses

886 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