A user's access to Microsoft® Exchange Server information is handled in a thread of execution within the Microsoft® Internet Information Server (IIS) process. If the user wants authenticated access — to open a mailbox, for example — this thread must impersonate a Microsoft® Windows NT® security context. In other words, to be granted authenticated access to the Microsoft Exchange information store, a thread must be associated with a set of valid security credentials.
The impersonation process has two parts:
At the time of user logon, use a command such as the following (from the file lib\logon.inc), to save the current security context in the session object:
Session("hImp") = objRenderApp.ImpID
hImp = Session("hImp")
set objRA = Application(bstrRenderApp)
objRA.Impersonate(hImp)