Groups | Blog | Home
all groups > inetserver asp components > november 2004 >

inetserver asp components : Use the Response object instead of IScriptingContext?


Richard Hollis
11/6/2004 5:46:30 PM
Microsoft docs say that IScriptingContext is obsolete, "you should not use
it except in legacy ASP applications. The interface exposes methods that
your component can use to retrieve the ASP built-in objects."



I have a control, which can render some large pages, and these are currently
returned to the calling ASP page in the form of a BSTR, which is then in
turn passed, to Response.Write.



Should I continue to use this approach or should I really by trying to write
directly to the stream itself? And, if I should be trying to write to the
stream then how should I obtain the Response stream object inside the COM
object?



Richard

Richard Hollis
11/8/2004 9:18:15 PM
Found the answer to this in:

http://groups.google.com/groups?hl=en&lr=&threadm=525201c2bcca%24e7b85c30%24d2f82ecf%40TK2MSFTNGXA09&rnum=4&prev=/groups%3Fq%3Diresponse%2Bobjectcontext%26hl%3Den%26lr%3D%26selm%3D525201c2bcca%2524e7b85c30%2524d2f82ecf%2540TK2MSFTNGXA09%26rnum%3D4


[quoted text, click to view]

Egbert Nierop \(MVP for IIS\)
11/11/2004 12:57:30 PM
Yes but obviously, you can't use ASP within an ISAPI DLL if that was not
what you were trying to do, then GetObjectContext will work of course.


hr = CoGetObjectContext(IID_IObjectContext, (void **) &m_piObjContext);

if (SUCCEEDED(hr))

{

// Get the ASP intrinsic Interfaces

CComQIPtr<IContextProperties> pProps(m_piObjContext);

if(pProps != NULL)

{

// Get Request Object Pointer

AllocCString(&bstrProp, L"Request");

hr = pProps->GetProperty(bstrProp, &vitem);

if (hr == S_OK)

{

vitem.pdispVal->QueryInterface(&m_piRequest);

::VariantClear(&vitem);

}

AllocCString(&bstrProp, L"Response");

hr = pProps->GetProperty(bstrProp, &vitem);

if (hr == S_OK)

{

vitem.pdispVal->QueryInterface(&m_piResponse);

::VariantClear(&vitem);

}

}

etc
--
compatible web farm Session replacement for Asp and Asp.Net
http://www.nieropwebconsult.nl/asp_session_manager.htm

[quoted text, click to view]
AddThis Social Bookmark Button