LibraryEASYProcess Reference ManualProcessesServicesHtmlWorkshopRemoveFromSession

RemoveFromSession Overview

RemoveFromSession is used to remove existing session variables from the user’s session. If this service is used to remove a varaible which does not exist yet or existed in a previous session, the service still returns “True” since the end result is the same as it having existed and being successfully removed.

Storing information in session variables can be useful if you want a certain value to be accessed after a few pages, but won’t be carrying that information forward via query strings.

Session variables are special variables that exist only while the user's session with your application is active. Session variables are specific to each visitor to your site. They are used to store user-specific information that needs to be accessed by multiple pages in a web application. Unlike a cookie, the information is not stored on the users computer.

The default behavior is to store the session variables in the memory space of the Internet Information Services (IIS) worker process. If you are using this default in-memory session management, the session variables will be cleared when worker process recycles. IIS Worker Process Recycling is the process whereby IIS kills off the child processes that it spawns to handle incoming requests and starts clean copies of them. Over time, problems could arise in the processing (memory leaks in the application code, undisposed resources, etc.) that IIS wants to clean up without having to shutdown the server. So it will periodically tell the worker process to die off, and spawn a new one.

The user’s IIS session ends when the worker process is killed. This happens on the session timeout (timeout set in IIS on application pool) or when closing the browser. After this point the session variables saved previously will be lost. If you need the variables to be around for longer than this, consider using cookies.

RemoveFromSession is not often used, because if you want to override the value, it does not require a remove first. You simply need to run another AddToSession service with the new vaue and same name.

RemoveFromSession Use Examples




RemoveFromSession Use Examples

Basic RemoveFromSession Use

In this example we have a button process which first tries to retrieve our TestVariable. If it is not found, it adds it and we try to retrieve it again.


This time it will work and we output the value of the variable to the user in a message.

If the variable was found, we remove it from the session. The RemoveFromSession returns a “True” or “False” depending on whether it was successful. Once it is removed, we try to retrieve it again.

Now, when we output the message to the user, it will be blank because the variable no longer exists.

Powered by EASYProcess (© 2019 K-Rise Systems, Inc).