Is there a session for Windows based applications for C# in order to record the details of log in in and log out for multiple users?
I tried to use declaring static variables, but it is not the same as a session.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There is no concept of session variables in Windows Forms. You can do:
Create a static class that holds the user name and password and any other variables needed across the application.
In your case it would be something like:
Now you can access the UserID simply from anywhere in your code:
Or set the values after login like: