Forum  Core :: SDK (Vi...  Using the Visua...  Automatic Logout when user is idle
Previous   Previous
 
Next   Next
New Post  1/14/2010 9:43 AM
   ori.cohen
4398 posts
1st Level Poster




Re: Automatic Logout when user is idle 
Modified By ori.cohen on 1/14/2010 1:47:17 PM)

Hello Alexnaldo,

To do this, you would need to use a Visual WebGui Timer.
You would have to reset the timer on every request from the client, that is not a "KeepConnected" request.

As you will need to act on every event of every Component in the system, you will probably need to create a Library assembly in which you will create classes that will derive from all the Visual WebGui components you are using, to override their FireEvents method, and add an EventFired class member event.
In that overriding method you would of course call the base method, but also fire the EventFired event, if any method is registered to it.
When the library is ready, you could use your extended Visual WebGui controls instead, on your Form. You will be able to resiter an event listener method to the EventFired event of the relevant controls you are using, and in that method reset your Timer.
It would be wise to act only on events that are triggered by user actions in the FireEvent  methods. To determine this, you could base this logic on the 'Type' string property of the event object that you receive as an argument in the FireEvent method.

On the Tick event of the Timer you could set the main UserControl on your Form (showing the content of the application) to Visible false, and show a different UserControl requesting the unlock details.
Similarly you could open a modal dialog that requires these details, but that is not a good an option from many views.

I advise you to add a Session or Context variable that would say if the user is in locked mode or not, so if a user opens a different MainForm in the same browser, they will not be able to get that page without unlocking first, even though they are still logged-in, in that session (or context in VWG v6.4).

Regards,

Ori Cohen
Support Manager, the Visual WebGui team

 
New Post  1/16/2010 2:10 AM
   Alexnaldo
294 posts
www.automato.org
4th Level Poster


Re: Automatic Logout when user is idle 

 Thanks Ori.

I would like to create a more "generic" solution without replace any VWG components.

function InitSessTimeOut(timeout) {
    mTimeOut = timeout;
    //mStrGuid = strGuid;
    document.body.onmouseover = function() { OnMove() };
    document.body.onkeypress = function() { OnMove() };
    //call the function at 10 sec
    timer = setTimeout("timedCount()", 20000);
}

Did you see the above code from the first thread ? Is not it a good solution to what I need ?

Thanks,
Alexnaldo Santos

 

 
New Post  1/19/2010 4:31 AM
   ori.cohen
4398 posts
1st Level Poster




Re: Automatic Logout when user is idle 

Hello Alexnaldo,

You have two options for this:

1. If you want to show the Unlock screen immediately when the lock time is reached.
In this case you create a CustomControl that sends a critical event to the server telling it to set the IsLoggedIn session/context veriable to false.
This would cause the default Logon screen to load on the client. When the client loggs in, the previous open Form will be loaded.

2. If you want to show the Unlock screen only as a result of a request of a server action when the lock time is reached.
In this case you can create a CustomControl that creates a non critical event whenever the mouse is moved or a key is pressed, for example. This way, when a critical event is fired (a server action is called), the server will know to set the IsLoggedIn session/context veriable to false.
This would cause the default Logon screen to load on the client. When the client loggs in, the previous open Form will be loaded.

Regards,

Ori Cohen
Support Manager, the Visual WebGui team

 
Previous   Previous
 
Next   Next
  Forum  Core :: SDK (Vi...  Using the Visua...  Automatic Logout when user is idle
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS