
URGENT: ASP Components from Visual Basic -- Help Required Please
Thanks for the answer Yuri...
In my simplified example the amount of text that was being passed back to
the ASP page was minimal and in fact, the method that you suggest is how I
have coded all of my previous ASP components.
This component however is going to be responsible for generating hundreds of
lines of HTML which I am reluctant to simply pass through a Variant (for
speed reasons amongst others)
If the ObjectContext method is for MTS only, does this mean if I register my
component with MTS I will have access to the Response object then?
Thanks
Dave
Quote:
> Hello Dave,
> You seems to mess up MTX and ASP.
> GetObjectContext function supposed to return MTX context object. This
object
> doesn't have property Item and it doesn't have method 'Write'.
> I would rewrite your code like this:
> -- Visual Basic Code --
> Option Explicit
> Public Function MySub()
> MySub = "Hello World"
> End Sub
> -- ASP Code --
> <%
> option explicit
> dim oObj
> set oObj = Server.CreateObject("MyObj.Test")
> %>
> <html>
> <head></head>
> <body>
> <% =oObj.MySub %>
> </body>
> </html>
> <% oObj = nothing %>
> Note that your sub becomes function and you simply return Variant value.
> in ASP code you use construction <%=function.call%> which will effectively
> insert return value of functon into HTML body.
> Regards,
> Yuri
> > Hi all,
> > I really hope that someone out there can help me solve this really
really
> > simple (i think) problem that i am having.
> > I am developing (using Visual Basic 6) a web site which uses several ASP
> > components and have had no problems developing my components until this
> new
> > component which needs to access the ObjectContext and Response objects
> > Here is a sample of some code which should work but that I am having
major
> > problems with
> > -- Visual Basic Code --
> > Option Explicit
> > Public Sub MySub()
> > Dim oCtx As ObjectContext
> > Dim oRes As Response
> > Set oCtx = GetObjectContext
> > Set oRes = oCtx.Item("Response")
> > oRes.Write ("Hello World")
> > End Sub
> > -- ASP Code --
> > <%
> > option explicit
> > dim oObj
> > set oObj = Server.CreateObject("MyObj.Test")
> > %>
> > <html>
> > <head></head>
> > <body>
> > <% oObj.MySub %>
> > </body>
> > </html>
> > <% oObj = nothing %>
> > When I try to compile and run the Visual Basic code using the ASP page,
i
> > get the following error
> > Error 91: Object variable or With block variable not set
> > This is due to the fact that within my component code the oCtx variable
is
> > never successfully set, basically GetObjectContext is always returning
> > "nothing"
> > I am sure that this is something to do with my own stupidity but I
simply
> > cannot find a way around it!!!
> > Any help gratefully appreciated
> > Dave