Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I maintain session in windows forms?

I want to maintain session on a windows application.

How do I maintain the session of a user like we use in ASP.NET to track the user information?

like image 734
anjum Avatar asked Apr 09 '26 06:04

anjum


2 Answers

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.

like image 174
HCL Avatar answered Apr 11 '26 18:04

HCL


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.

like image 20
Oded Avatar answered Apr 11 '26 18:04

Oded



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!