问题
I want to add a "Remember Me" check box to the login form of my WPF App. What's the best way to do this?
Currently the app logs in via a websevice call that returns an authenticated token that it uses for subsequent calls. Should I simply two-way encrypt and store this token somewhere in the files system?
回答1:
You could also store it in Isolated Storage or create a User setting in your application's Settings.
Edit: Oren's suggestion of using DPAPI to protect information is well and good, but it doesn't store anything:
An important point to remember is that DPAPI merely applies cryptographic protection to the data. It does not store any of the protected data; therefore applications calling DPAPI must implement their own storage of the protected data.
回答2:
Use the DPAPI. See also How to store passwords in Winforms application?.
来源:https://stackoverflow.com/questions/1244578/best-way-to-implement-remember-me-check-box-in-winforms-wpf