The CheckAMSession function checks for a valid CDO session (a connection to the server), and returns the CDO session in the Session object. It should be at the beginning of the script. It is important to call CheckAMSession before sending any HTML to the browser; otherwise, any redirects, authentication, and so on, may not work.
If no session is found, CheckAMSession calls the NoSession function. If the CDO session does not exist and the URL does not contain server and mailbox data, a logon form will be sent to the user to fill out.
The CheckAMSession function returns True if a session exists or can be created.
The following call to the Session object retrieves the "AMSession" named property.
Set amSession= Session( "AMSession")
Previously, in the global.asa file, Session( "AMSession") was set to Nothing. Now, in the first call to the CheckAMSession function, it still is Nothing. When it is Nothing, the NoSession function is called to create a session. Upon return, the existence of a session is checked once more, again in the call
Set amSession= Session( "AMSession")
After this, CheckAMSession is set to True if a session has been successfully recognized or started.