Can I write to the browser directly from My COM Object ???
Printable View
Can I write to the browser directly from My COM Object ???
You can't really do it directly, but you can do it this way:
In your com object, you have a function or a property get, but for ease of demonstration I'll use the function example.
The com object is named Talk.dll with class module named Friendly and the function is named SayHello.
Function SayHello
SayHello = "<P align=""center""><Font color=""red""">HELLO FRIEND</Font></P>"
Exit Function
In your asp;
Set objTalk = Server.CreateObject("Talk.Friendly")
Response.Write objTalk.SayHello
yes well . that is the way I working now. but, I thought there might be a way to write directly to the browser.
THanks anyway
hi,
u can directly use the asp objects from ur component by including asp dll.
once u refer the asp dll then u just have to call the method of the component and that component will display the details on the browser.
bye
:)
In your ASP File call the function and pass the objects as parameters, like:
Dim objAPP
Set objAPP = Server.CreateObject("myProject.myClass")
objAPP.RenderPage Application, Request, Response, Server, Session
Set objAPP = Nothing
Add two References to your component using the Project|References menu: "COM+ Services Type Library" and "Microsoft Active Server Pages Object Library" (be sure to select the one from the IIS - asp.dll from system32\inetsrv directory - because is a second one from visual studio...).
Your class in your component now needs the corresponding function:
Public Sub RenderPage(objApp As ASPTypeLibrary.Application, _
objReq As ASPTypeLibrary.Request, _
objRes As ASPTypeLibrary.Response, _
objSrv As ASPTypeLibrary.Server, _
objSes As ASPTypeLibrary.Session)
objRes.Write "blablabla"
...
End Sub