capture system login and logout timings RRS feed

  • Question

  • User-47435888 posted


    can any one help me how to capture the timings when the user has exactly logged in and logged out with his/her login name using vb.net

    thank you


    Saturday, January 28, 2012 10:46 PM


All replies

  • User-1956819616 posted

    a simple insert to database when a user clicks login or logout with the current time,

    but it depends on what base code you are using exactly, and if you are using custom code or not for doing log-in/log-out

    Sunday, January 29, 2012 4:25 PM
  • User-47435888 posted

    Hi Mark,

    do you have any code sample how to capture the time of login and logout.





    Monday, January 30, 2012 9:19 PM
  • User612574037 posted


    You may want to get the client time when the user login or logout. You can refer to the below code.

    <head runat="server">
        <script type="text/javascript">
            function displayTime() {
                var localTime = new Date();
                var year = localTime.getFullYear();
                var month = localTime.getMonth() + 1;
                var date = localTime.getDate();
                var hours = localTime.getHours();
                var minutes = localTime.getMinutes();
                var seconds = localTime.getSeconds();
                var div = document.getElementById("div1");          
                div.innerText = year + "/" + month + "/" + date + " " + hours + ":" + minutes + ":" + seconds;                
        <form id="form1" runat="server">
        <div id="div1">
        <asp:Button ID="Button1" runat="server" Text="Login" OnClientClick="displayTime();" />


    Tuesday, January 31, 2012 3:05 AM
  • User-47435888 posted

    Hi Qi Wu,

    thanks for your input,

    but is it possible to capture the time using VB.net, my main purpose of this is to save that data in database and generate reports.

    my idea is to create an EXE and install it in the client system, when ever client swith on the system i wll run this EXE using GPO(group policy) and capture the system time and save it in database. also same for the shut down.





    Tuesday, January 31, 2012 3:46 AM
  • User-1831219222 posted

    you can store both login/log off time on database and access whenever you need. this link might be helpful:


    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, January 31, 2012 9:55 PM