Kill Session for Duplicate Login

Vineeth.R
Member Posts: 121
Hi Friends,
My customer do not want any user to login twice to navision with his/her ID.
I decided the write the code in Codeunit 1 - CompanyOpen function. If i test the below code by logging in as 'SA' UserID then the code works and the duplicate session is killed. But the code fails if i login twice with any other user login.
I think since other than 'SA' nobody can see the session records the code is not working. Any suggestion to overcome this?
CREATE(WinShell);
LSession.RESET;
LSession.SETCURRENTKEY("Login Date","Login Time");
LSession.SETRANGE("User ID",USERID);
LSession.SETFILTER("Database Name",'%1','Demo Database NAV (6-0)');
IF LSession.COUNT > 1 THEN BEGIN
IF LSession.FINDLAST THEN
WinShell.SendKeys('%{F4}');
END;
Pls help.
My customer do not want any user to login twice to navision with his/her ID.
I decided the write the code in Codeunit 1 - CompanyOpen function. If i test the below code by logging in as 'SA' UserID then the code works and the duplicate session is killed. But the code fails if i login twice with any other user login.
I think since other than 'SA' nobody can see the session records the code is not working. Any suggestion to overcome this?
CREATE(WinShell);
LSession.RESET;
LSession.SETCURRENTKEY("Login Date","Login Time");
LSession.SETRANGE("User ID",USERID);
LSession.SETFILTER("Database Name",'%1','Demo Database NAV (6-0)');
IF LSession.COUNT > 1 THEN BEGIN
IF LSession.FINDLAST THEN
WinShell.SendKeys('%{F4}');
END;
Pls help.
Thanks and Regards
Vineeth.R
Vineeth.R
0
Comments
-
Hi Vineeth.R
Do you get an error when you’re loggin in with login nr2.?
Can’t you just delete the record in the session table instead of using winshell?IF LSession.FINDLAST THEN LSession.Delete(True)
Just an idea0 -
Hi VonHazzel,
ok i will try that.
problem is when normal user other than 'SA' if try to login twice the below cose does not work from his login because he cannot access the session table. So the below written code does not work.
How to make it work?
Thanks
VineethThanks and Regards
Vineeth.R0 -
How about using NAS to check duplicate login and kill session.CA Sandeep Singla
http://ssdynamics.co.in0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions