I want to maintain session on a windows application.
How do I maintain the session of a user like we use in as.net to track the user information?
I want to maintain session on a windows application.
How do I maintain the session of a user like we use in as.net to track the user information?
If you mean sessions like in asp.net, then there is no need. Windows applications maintain state, unlike web applications.
This does not include shutting down and restarting the application.
If you mean, how one can serialize program settings the user has done using your app, and you want to restore them after the program has restarted, an easy way is the built in settings-management. This works with WinForms and WPF:
In VS under properties, you can define all settings that in the app are used (inclusive data-type) and then you can set and get values over the Properties.Settings.Default
-Property. Please note that there exists two type of settings: Application and User. The one you will need to save "session"-state of your user, is User.
See here for more information about saving settings in .net windows applications.
If you just want a container to keep a key value pair for as long as the application is running, you can use System.Web.Caching.Cache or you can use the Caching api in .NET 4