How to Clear Session Variables
Session variables provide programmers with a method of tracking logged-in users and are used in web programming. When a user logs into an application, a session variable is synced with the browser and the web server. It identifies the user as an authorized person on the website. After the user logs out of the application, the programmer clears the session variables. This type of .NET programming is accomplished using only a few lines of code.
Instructions
-
-
1
Load Visual Studio and load your Visual Basic project. Right-click the form you want to edit and select "View Code." This opens your code-behind file for your web project.
-
2
Scroll to the location of the file where the user logs out or the session clears. Use the following code to clear the session variables:
Session.Clear() -
-
3
Save the changes and press "F5" on your keyboard. This compiles the new code and runs the application in your browser to test the new session changes.
-
1
References
- Photo Credit internet - eingabefeld internet http://www image by pmphoto from Fotolia.com