Rebuilding Cat Translation This paper This article uses a simple Sample to modify how we are familiar with ASP objects (Request, Response, Session, etc.) in the components written in VC ATL. You will find that using ATL Object Wizard in Visual C can achieve our goal. But using onStartPage, OneundPage event is not the best way. In IIS3.0, the component can access an ASP built-in object via the iScriptingContext interface, but this is to access an internal object through a page-level method. Now there is a better implementation method, which is to access directly with the ObjectContext object. ObjectContext makes IIS applications better scalability, providing a better transaction processing. It is highly recommended that you convert the original applications to this way, but ask your application to support transaction processing. The code first needs to include some of the necessary library files. We need MTX.H to define some constants, get the IObjectContext interface through Mtxas.dll, get ASP objects via ASP.DLL. #include #import "c: /winnt/system32/mts/mtxas.dll" #import "c: /winnt/system32/inetsrv/asp.dll" Then, we transfer to the IOBJECTCONTEXT interface. MTXAS :: ObjectContext; hResult HR = getObjectContext (IOBjectContext **) & pobjectContext); Next, get what we need through the Context object. Here is two examples: Session and Response. // Session Object CComVariant v; CComBSTR bstr (L "Session"); CComQIPtr (IGetContextProperties)> pProps (pObjectContext); hr = pProps-> GetProperty (bstr, & v); CComPtr pDisp; pDisp = V_DISPATCH (& v); CComQIPtr ( ASPTypeLibrary :: ISessionObject)> pSession (pDisp); // Response Object CComVariant v; CComBSTR bstr (L "Response"); CComQIPtr (IGetContextProperties)> pProps (pObjectContext); hr = pProps-> GetProperty (bstr, & v); CComPtr PDISP; PDISP = v_dispatch (& V); ccomqiptr (asptypelibrary :: IRESPONSE)> PRESPONSE (PDISP); Finally, a simple example of using this object. // Retrieve a value from the Session Object CComBSTR bstrVarName (L "TestSessionVar");. VARIANT * pValue; pSession-> get_Value (bstrVarName, pValue); // Write that value out to the browser pResponse-> Write (pValue). Summary Although this is just a very simple component called an ASP built-in object in the component written in VC , you can do more in this principle. Good luck.