How to control/kill sessions?

2

Comments

  • krikikriki Member, Moderator Posts: 9,086
    navuser1 wrote:
    kriki wrote:
    You don't need to have the form open to kill sessions.
    The NAS using the codeunit kills the sessions.

    Each customer license has 1 NAS for free.

    How will NAS kill the Idle Session ??

    Will NAS call the Session Killer Codeunit again again automatically . ??
    The NAS kills a session by deleting it's record in the Session-table.

    The NAS (function ID 99 in codeunit 1 calls the session killer codeunit only once. In the OnRun of the codeunit, the Timer automation is initialized and each N seconds the automation calls an automation-trigger in the codeunit that does the controls and optionally kills users.

    @karthikeyan_atna: download this and check the code for an example. You can also use this instead of re-inventing the wheel.

    @adirane: did you install NAV2009SP1 or did you just copy the subdir? You need to register the NAV timer dll for the automation.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • navuser1navuser1 Member Posts: 1,329
    Dear All,

    I want to install NAS on one of my Client PC (OS: Windows XP) to Kill the Ideal Session (Ideal Time: More than 1 One hour).

    I have defined the 1 minute time Interval for the Navision Timer Automation ('Navision Timer 1.0'.Timer) to execute code for killing the Ideal sessions.

    Will this setup create any issue in future ??

    Kindly reply
    Now or Never
  • krikikriki Member, Moderator Posts: 9,086
    No.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • navuser1navuser1 Member Posts: 1,329
    I'm Using Single Instance CU. My Code is geven in Screen Shot
    Now or Never
  • southindiansouthindian Member Posts: 247
    Hi all,

    As per the procedures i have installed the NAS And the even activated the services also , but now the problem is the code that i have added in codeunit 1 is not getting triggered. even i tried with putting a message. but it doesn't trigger. what will be the actual Problem . can some one guide me.
    The code i have added in Codeunit 1 is

    'SessionKiller': CODEUNIT.RUN(CODEUNIT::"Single Instance Codeunit");
  • krikikriki Member, Moderator Posts: 9,086
    Try:
    'SESSIONKILLER': CODEUNIT.RUN(CODEUNIT::"Single Instance Codeunit");
    

    and also use upper-case when installing the NAS.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • southindiansouthindian Member Posts: 247
    i have added the modified code in codeunit 1 but still not getting triggered. even i tried with putting a message. but it doesn't trigger. what will be the actual Problem .

    Where do am actually lacking?

    Suggestion welcome.
  • SogSog Member Posts: 1,023
    Does this work with the RTC? (haven't tried it)
    Because when deleting a session from a RTC-user, it reconnects.

    To southindian: put a message before all the code in the nashandler trigger. If the message doesn't show up in your eventviewer, you probably don't have a NAS running. If it does, go to the case and put a message after your 'SESSIONKILLER' case, and a different one in the "case else". If you have the nas running in a loop (ie CGNASStartedinLoop = true) then it won't work.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • krikikriki Member, Moderator Posts: 9,086
    You can also run the NAS from the DOS-prompt and also using the parameter "debug" so the debugger starts and you can see what happens in the NAS.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • southindiansouthindian Member Posts: 247
    Dear Sirs,
    Finally My NAS connection is working fine and Session Killer Is started. Thank for Valuable help in crucial time.

    Thank you sir(Kriki and Sog).

    For furthur query i will be Back here.
  • southindiansouthindian Member Posts: 247
    Dear all,

    Thanks for all those have helped me. But now am facing a problem, am getting a warning error " You don't have Permission for accessing the Session killer Table". Even i had Save the objects in 50000 series , but still am getting the same Problem . I have tried with changing the license , but am getting the same problem.

    Can some one help me out in this.


    With regards,

    Vijay
  • mohana_cse06mohana_cse06 Member Posts: 5,503
    Did you try by uploading the license?

    is this the first time you are getting permission error for Table 50000 and are you able to run it before(may be different table)?
  • southindiansouthindian Member Posts: 247
    tried all option ... but getting the same error .

    I dont know what to do?
  • beyrembeyrem Member Posts: 10
    Hello,

    How could I do to add a message for the user to inform him that the connection was killed (using this same tool)?

    Thanks.
  • SogSog Member Posts: 1,023
    Will be tricky, because you should store if a session was killed or not, so that the session that was killed can read it when closing the company, but since the session was killed, it can't read any tables anymore.
    So you'll have to show the message to the user before the sessionkiller kills the session.
    |Pressing F1 is so much faster than opening your browser|
    |To-Increase|
  • colingbradleycolingbradley Member Posts: 162
    I had to renumber the objects, all fine and compiled, I cannot run the form 80000, I get an error that - "You cannot open a subform within a subform".
    I have tried deleting the subforms and creating them again but still get the message.
    :-(

    NAV 2009-2
    testing in Native Classic

    Any ideas?

    Thanks,
    Colin
    Experience is what you get when you hoped to get money
  • krikikriki Member, Moderator Posts: 9,086
    It means you have a form in which you defined a subform. And that subform in itself has another subform. That is when you get that message.

    In your case, I think that by renumbering, you have a form with ID=X and that form has a subform with ID=X. So it refers to itself as a subform. You need to fix that.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • colingbradleycolingbradley Member Posts: 162
    Yes, there are 2 subforms, the first ID is 1101322012 and the second ID is 1101322013.
    The main form is supposed to have both subforms so no obvious problem there.
    Main form ID is 50013
    ](*,)
    Experience is what you get when you hoped to get money
  • krikikriki Member, Moderator Posts: 9,086
    And in the main form, to which subforms point the 2 subforms? (not the ID of the control but the ID of the subform)
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • colingbradleycolingbradley Member Posts: 162
    IC, all done, the ID was the Form Name of the main form for one of the subforms.

    Many Thanks
    :oops:
    Experience is what you get when you hoped to get money
  • navgirl1981navgirl1981 Member Posts: 12
    Does this work on NAV 2013 ?

    Thanks
  • krikikriki Member, Moderator Posts: 9,086
    The forms definitely not.
    The codeunit, I don't know. I haven't tested it yet. But it is on my todo-list.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • NokioNokio Member Posts: 52
    Hi,
    in our DB the sessionkiller does not kill the sessions. The NAS is running properly and the sessionkiller also starts like he should. I also tried to start the codeunit 80000 manually. I've made a screenshot of the setup.
    Does anyone has an Idea what the problem could be?


    Regards
  • krikikriki Member, Moderator Posts: 9,086
    You need to fill in the field "No. of licensed user S...". This fields must contain the no. of licensed users in the DB. You can also put it to a slightly lower no. to have an extra buffer.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • NokioNokio Member Posts: 52
    Hi Kriki,
    I tried it out, but it does not work.
    I have another DB, where I've setup this tool on the same way. On this DB the SESSIONKILLER does work properly. But on the one in the screenshot it doesn't. :(
  • krikikriki Member, Moderator Posts: 9,086
    Try to debug the NAS to see what it is doing (or NOT doing).

    BTW: the NAS-user has permissions to kill sessions in SQL (in case you are using SQL)?
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • berniebernie Member Posts: 7
    Hello Kriki,

    Can you tell me if this works for killing RTC-sessions in Microsoft Dynamics NAV 2009 R2?

    Someone asked before but is not clear for me.

    With best regards,

    Bernie
  • krikikriki Member, Moderator Posts: 9,086
    I haven't tested it with NAV2009R2 RTC clients, but considering the clients connections are forwarded to SQL Server and show up in the Sessions table, I think it should work.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • prasad4spprasad4sp Member Posts: 4
    I am using Session killer on Nav 2009 client. When I am deleting session entries from session table, Sessions are getting killed properly.

    Now when I am executing this Session killer code, Session Entries are getting deleted from Session Table, But Sessions are not getting killed. When I click into those killed (Not actually killed) sessions, Session seems active and Idle Time of the session getting resetted.

    What can be the reason?
Sign In or Register to comment.