简体   繁体   中英

Where is the best place to store the logged user and information

I've found a lot of answers for web applications, but none for winforms.

I want to store the user (id at least), the UI language in use and other general info that should last for the time a user is connected. Note: I'm developping a DLL.

So to summarize, I need to store the data while the application is open. When it's closed, all the infos can be disposed.

Possible solutions: - Keep the information in a static class, but it's probably a bad practice. - Create a class which has to be sent in parameter to whatever is called/instanciated in the DLL - Create a class and find a way to make it reachable from other places in the DLL (I don't know any way to achieve that)

Note: I do not use Windows' Active Directory. Note 2: I don't need to store sensitive data like the password

You can save your user data in an encrypted file. You would build an xml file then use synchronous encryption to save it. (Synchronous means you have a common key to decode it, which you could put in a static class). Search synchronous xml encryption c#

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM