NetTalk Central

Author Topic: Setting Session time out value.  (Read 4043 times)

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Setting Session time out value.
« on: August 06, 2012, 10:08:18 PM »
Hi
I can set  the s_web object's session time out value in the WebServer procedure when the server program starts. I also would like the user to be able to edit session time out value from within the web application itself. I believe the code to do this is as follows:
      P_WEB.RequestData.WebServer._Wait()
      P_WEB.RequestData.WebServer._SitesQueue.Defaults.SessionExpiryAfterHS=L:SESSION_TIMEOUT
      P_WEB.RequestData.WebServer._Release()
However this code appears to be only changing the session time out value for current session that ran this code. All other and new sessions appear to have the value set in the WebServer procedure. Is there a way to set the s_web object timeout value from within a session?

Thanks
Rob Kolanko

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Setting Session time out value.
« Reply #1 on: August 07, 2012, 02:52:58 AM »
>> I also would like the user to be able to edit session time out value from within the web application itself.

for himself only, or for all users?

Also, Is your 3 lines of code there a simplification?
the _sitesQueue property is a Queue, so you would need to do a GET on the queue before setting the value, and a PUT afterwards.
(there's a section in the book on manipulating the session queue)

cheers
Bruce

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Setting Session time out value.
« Reply #2 on: August 07, 2012, 05:06:38 AM »
Hi,

This idea i've used may not be appropriate, but i'll explain what i've done.

I don't ever want a use to get a session time out. So what i do, is on the footer of every page, i have a small amount of javascript that talks to the server say every 5 minutes, reminding it that my browser window is still open.

So i set my session timeouts to say 10 minutes. While ever a window is still open, the session remains active. If the browser is closed, within 10 minutes the session will be deleted.

This way i don't generate very much additional traffic to the server and I never have sessions timesout (unless they lose internet connection or similar).

Regards
Bill

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: Setting Session time out value.
« Reply #3 on: August 07, 2012, 06:33:42 AM »
++ for Bill's solution.
Cheers,

Stu Andrews

Rob Kolanko

  • Sr. Member
  • ****
  • Posts: 253
    • View Profile
Re: Setting Session time out value.
« Reply #4 on: August 07, 2012, 06:34:23 AM »
Hi Bill and Bruce,
Thank-you for your replies,

Bill,
I love your approach, I wish to know more on the javascript that you used and where it communicates to on the server. If you could post an example, I am sure that I and other developers would be indebted to you. Most of my customers would love this feature, unfortunately, a few of my customers are not be permitted to have a continuous active session, as they have security policies that require the web session be disabled after a specific time of inactivity. Thus I would add a configuration option to allow this feature for those that want it.

Bruce,
My request is for my customers' system administrators to set the timeout value for all the users. Each customer has a different idea on what the timeout value should be. Thus our application has a configuration page that only administrators can access where they can enter the timeout value for all users. I really do not need to change the timeout value for the current sessions that are currently active, just the new sessions started at that point. I used the section in the book on accessing s_web from p_web and copied the code that I used to initialize the s-web timeout. Inspecting the webserver  procedure code, I now see that I will need to get the _SiteQueue  queue record first. Is there only one record in this queue or how does it work?

Rob Kolanko

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Setting Session time out value.
« Reply #5 on: August 07, 2012, 11:22:16 PM »
regarding the javascript, in the footer, something as simple as this would suffice;
create a netwebSource procedure with a timer, set to say 10 minutes.
Include this source in your footer as a tag. For example;

<!-- Net:SomeProc -->

Cheers
Bruce

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Setting Session time out value.
« Reply #6 on: August 07, 2012, 11:23:45 PM »
regarding the queue;

there is only one record unless you are running under the multi-site host. If you are running under the host then there are multiple records (one for each dynamic site being managed by the host).

cheers
Bruce