locked
How to Create an Auto Log off Feature in Windows 8 Store Apps

    Question

  • Let's say that I'm using Windows authentication, in the sense that a user logs into a network using his tablet with his Windows ID and password, and then invokes an action in the Windows 8 store app to log into the specific app. This latter action communicates with a remote service and returns a separate user ID. Now, with that second ID, I want to accomplish these two tasks:

    1. How can I log a user out of a Windows 8 store app after a set period of inactivity? Inactivity being defined as no data being sent to the server.
    2. How can this auto log off feature be reset after each client-side action (like swiping) even when there is not server-side activity?

    Any guidance would be great. Thanks.



    • Edited by IMOsiris Thursday, June 12, 2014 8:37 PM
    Thursday, June 12, 2014 8:15 PM

Answers

All replies

  • Most of this will depend on the app's logic: you will have to define what exactly you mean by logging out and by appropriate actions.

    The basic idea will be to set a timer to periodically check idleness. You can keep a last-action time-stamp which gets update whenever the app receives a Pointer* or Key* event, or whenever it talks to the server, or whatever other events you want to define as activity.

    When the timer sees that the last-action time is more than the timeout it can trigger the logout.

    --Rob

    Thursday, June 12, 2014 9:35 PM
    Owner
  • So there isn't a built-in feature to log an idle user out as there is in ASP.Net through the web.config file?

    Thursday, June 12, 2014 9:51 PM
  • There isn't a built-in concept of logging into an app. Users log into the system, which has its own idle locking mechanism.
    Thursday, June 12, 2014 9:53 PM
    Owner
  • Ok, one last question: where does the system (that being, the device running the Windows 8 app) have a mechanism for setting the idle log out period? And thanks.
    Thursday, June 12, 2014 10:02 PM
  • Please ask questions about using Windows in the Windows forums on http://answers.microsoft.com . This forum is specifically about writing Windows Store apps.

    You can search your settings to find it. When I just did so I found some likely options under Power Settings. There may be something more specific that the folks in answers can tell you about.

    If you prefer wider searches try http://www.bing.com/search?q=Windows+8+set+lock+screen+timeout .

    --Rob

    • Marked as answer by IMOsiris Thursday, June 12, 2014 10:16 PM
    Thursday, June 12, 2014 10:12 PM
    Owner