Session Time-Out after User inactivity

hi friends

Can I enable Session-Time out for an user who has been Idle for certain minutes or hours? Is there any provision?

appreciate any help on that.

best regards

Hi Jacky10,

One way to handle this is to write a codeunit that checks the idle time, and if it exceeds a certain treshold you delete this session. You can use the job scheduler to run this codeunit, but the downside is that you need an extra session to run the job scheduler (and you need the correct granule).



and you need NAS.

Why would you need a nas ? The job scheduler doesn’t run in a NAS, but it runs in a real client.

what about if 200 users is connected to system
you will have 200 job schedulers active in same time.

you can, ofcourse, filter somehow to run That job scheduler on a single machine.
that, job scheduler (and your idle feature) will be active only when that client is active.

NAS is always active. That is why you need extra session on licence, cause NAS takes one session.

Eh, do you know what the job scheduler is ? The job scheduler is small module that comes with the service module. The job scheduler just needs 1 client and 1 session. In this 1 session it can run multiple codeunits, which you can schedule like the windows task scheduler.

So in this instance you would put 1 extra card in the job scheduler, with a name like ‘del sessions’, which would run your codeunit every 5 minutes.

Now every 5 minutes the system will check if there are any sessions that have expired.

You must compare the job scheduler just with a regular session of a user that pushes run on the codeunit every 5 minutes. It just takes 1 session to run 200 different codeunits. It has nothing to do with how many users you are connected.

yes, but run on which client?

bottom line is that it is not appropriate thing to delegate 24/7 jobs to clients that are not (or don’t need to be) online 24/7.

NAS is only client that is meant to be online 24/7.

Hey Jacky10,

If you are in v4.0 or later then the automated method from NAV code will work. I believe that one NAS license still comes included with the purchase of the license so you should have a Navision Application Server you can use. You could do something like this:

VAR
Sessions Record 2000000009 (Session)
UserSetup Record 91 (User Setup)
NTimer Automation Navision Timer 1.0
TimerInterval Integer;
IdleSessionTimeAllowed Integer;
IdleTime Decimal;

OnRun Trigger:
TimerInterval := 60; //in seconds //This could be a setup field
IF ISCLEAR(NTimer) THEN
CREATE(NTimer);

NTimer.Interval(TimerInterval * 1000); // in milliseconds 60000 = 1 minute

NTimer.Enabled(TRUE);

NTimer::Timer Trigger:
NTimer.Enabled(FALSE);
//Processing done between the NTimer.Enabled’s

IF Sessions.FINDFIRST THEN
REPEAT
IdleTime := Sessions.“Idle Time”/ 60000 //Convert to Minutes

//If you want to make the idle time a by-user setup, this is configured for minutes
//UserSetup.GET(Sessions.“User ID”);
//IF UserSetup.“Allowable Idle Time” > 0 THEN
// IdleSessionTimeAllowed := UserSetup.“Allowable Idle Time”
//ELSE

IdleSessionTimeAllowed := 15; //Minutes
IF IdleTime > IdleSessionTimeAllowed THEN
Sessions.DELETE(TRUE)
UNTIL Sessions.NEXT = 0;

NTimer.Enabled(TRUE);

NTimer::TimerError:
MESSAGE(‘An error has occurred!’);
CLEAR(NTimer);

That’s if you even want to automate it. If not just create a form, SourceTable Session. Then make it non-editable and put a button on it that will delete the currently selected record, DELETE(TRUE); in the OnPush trigger for the button. You can then manually control what session gets kicked and when.

You could also search here:
http://www.mibuso.com/forum/search.php
http://www.mbsonline.org/forum/search.asp

yes, you are right, I don’t know how, exactly, job scheduler runs delegated jobs but from arhitecture of navision system, If all clients are down, nothing will be executed (except MS SQL jobs) if there is no NAS.

Which means,

if job scheduler works in that way that in every few minutes it fires up a function in codeunit on every online client you get that same code runs X times where X is number of online users.

if job scheduler works in that way that in every few minutes it fires up a function in codeunit on single online client than you have dependencies of that client.

if job scheduler is set to be run from NAS, it fires up a function on single online client, but now, that client is meant to be online 24/7.

That is my point

Hell Jacky10,

Do you run LAN connections or via a Terminal Server?

With Terminal server you can set time-outs on client connections so inactive connections are automatically logged-off. We use Windows Terminal Server but I am sure you can achiev the same result with Citrix.

I think the other options (above) would be cheaper than migrating to a new environment!

[:D]

Dudes

I am relatively new to navision and we have just rolled out in one of our companies and still with c/side and database server… i thought there may be a small functionality which may help me to enable the session time-out thing, but going by your feedbacks it looks like a long haul for me atleast…:slight_smile: have taken note of all your suggestions nevertheless…!

Thanks for the overwhelming responses anywayz…

best regards

There are two products I know of that get good reviews for doing this:

http://www.autocloseidle.com/

and

http://www.expandit.com/

both of these products have been tested andshould work well with Dynamics NAV.