troubleshooting Question

How Can You Dynamically Set Session Timeout?

Avatar of TimAttaway
TimAttawayFlag for United States of America asked on
.NET ProgrammingASP.NET
4 Comments1 Solution1615 ViewsLast Modified:
Our intranet site has a large number of users out in the field and a handful of users here in the office.  The web.config specifies a session timeout of 20 minutes, i.e.

<sessionState  timeout="20"/>

I would like to increase the the timeout to several hours for the people who are located within our office complex.  I am trying to do that by resetting the session timeout value when they log in.  I look up information about the user from our database and then attempt the following.

            Dim instance As System.Web.SessionState.HttpSessionState =  HttpContext.Current.Session

            If thisIsALocalUser Then

                instance.Timeout = 240


                 instance.Timeout = 20

                End If

            End If

I have some javascript code that displays the session time remaining at the top of the screen and it thinks that the remaining time is 240 minutes, but the session still times out after 20 minutes.  It appears that the timeout in the web.config wins out even though I attempted to override it for a given user.

Question 1 is what happened when I did the "instance.Timeout = 240"?

Question 2 is how can I reset the timeout value for select individuals?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros