XAF has had support for logging off and logging back onto ASP.NET XAF applications for quite some time, remember that small red key icon in the corner of the screen?

Users have been asking us to introduce this functionality to Windows Forms XAF applications for a while now and in 10.2 we’ve finally introduced it!

What this means is that now you can log off from an application and log back on using another user’s credentials (or have another user log on) without having to restart the application!
We’ve introduced a couple of new events to the XafApplication class – LoggingOff and LoggedOff. You can handle the former, to cancel the log off process and the latter to be notified when a user has logged off.
If you’re using a custom logon parameters class, you can implement the newly introduced ISupportResetLogonParameters interface, to support logging off without restarting the application. Implementing the interface is quite straightforward, as it exposes a single Reset method. A typical implementation should just release all managed and unmanaged resources and reset all key properties, like so…
public class MyLogonParameters : ISupportResetLogonParameters
{
//...
public void Reset()
{
company = null;
employee = null;
password = null;
objectSpace.Dispose();
objectSpace = null;
availableCompanies = null;
availableUsers.Dispose();
availableUsers = null;
}
}
So when would you use such a feature? Okay, imagine this scenario; you write an application for use in a warehouse. You have just input an order and the application is working out the location of each item on order for automated picking. As each item is picked, by robot, the picking list is updated. Obviously this is a long running process. In the meantime, one of your colleagues finishes his or her shift and wishes to “clock out”. With this feature, you can log off, have them log on and “clock out” and then log back in again yourself, to see how your long running process is coming along!
Well that’s it for this post, until next time, happy XAF’ing!
Update:
The guys on the XAF team have asked me to update this post and let you in on some of the context for this feature. It was first requested by customers more than 3 years ago and ended up as a suggestion for our framework: Security.Win - Logon / Logoff without leaving application (http://www.devexpress.com/Support/Center/ViewIssue.aspx?issueid=S91410).
On the surface it looked like a specific feature and was not highly requested by other users. However, as time went on more and more customers asked for this functionality and so we created a KB Article, showing how to accomplish this task in the current version of XAF. To be honest, the temporary solution worked fine, but we knew it would be much better, and easier for our users, if it was implemented in the framework by default.
Over the next two years we continued to maintain this solution and provide some minor improvements and bug fixes. These bugs mostly occurred when migrating from one major version to another. Again, it seem to us that it would be less costly to have this feature as part of the framework itself.
Finally, the new application model in the 10.1 release, several related suggestions, as well as customer demand, made it possible to plan this feature for the 10.2 release. Early results of our work can already be seen in the 10.1.X versions, in which we introduced the log off procedure, demonstrated in the KB article, directly into the XafApplication class. Later, with the help of great customer feedback, we could support the most popular scenarios our customers needed, things like fast log off without the need to re-setup the whole application, support for custom logon parameters, support for scenarios in which user model differences were stored in the database, etc. We also refactored our Web library to provide the Log Off feature on the Core library level and finally polished the implemented functionality. Now we have a feature which consistently works on the two supported platforms.