I am basically a web developer , but I started to work on a chat system , I have to make different users , and I have to save their credentials permanently or for long period even when they close the application , in web apps we use session and caches for it but here I researched there is no session concept , I want to know how you people do this when you want to save users details permanently for a long time and don't want login over n over again , I want to do it just like Skype
Asked
Active
Viewed 240 times
-2
-
1There are too many ways to approach this problem. The answers would just turn into a straw-poll for which one people liked. The best thing is to do some research on the topic yourself, find two or three, _analyze_ them, determine if they work for you or not, and _try them out_. Come to us when you have a specific question about something you have attempted to do. – gunr2171 Mar 10 '22 at 19:14
1 Answers
-2
choices
- write to a file, Windows has well know places to store app specifc data, c# has classes that will return them to you. https://learn.microsoft.com/en-us/dotnet/api/system.environment.specialfolder?view=net-6.0
- write to the registry, this is where apps store settings. C# has classes for this https://learn.microsoft.com/en-us/dotnet/api/microsoft.win32.registry?view=net-6.0
- variant on#1 write to a DB like sqlite, overkill if you only have a few items. https://learn.microsoft.com/en-us/dotnet/standard/data/sqlite/?tabs=netcore-cli
writing to a file in c# is easy:
- File.WriteAllText
- File.ReadAllText

pm100
- 48,078
- 23
- 82
- 145