Problem writting out from a VB dll

Results 1 to 2 of 2

Thread: Problem writting out from a VB dll

  1. #1
    Join Date
    Dec 1969

    Default Problem writting out from a VB dll

    Hi!<BR><BR>I have some problems I want to write out a line of html code to my webpage.<BR><BR>Got some exampels code from a friend that looked like this<BR><BR>---------------------------------------------------------<BR>Dim objASP As ScriptingContext<BR> <BR>Sub OnStartPage(objSC As ScriptingContext)<BR> Set objASP = objSC<BR>End Sub<BR><BR>Public sub test()<BR> objASP.Response.Write "&#060;html&#062;"<BR> objASP.Response.Write " &#060;head&#062;"<BR> objASP.Response.Write " &#060;/head&#062;"<BR> objASP.Response.Write " &#060;body&#062;"<BR> objASP.Response.Write " I am from the VB dll"<BR> objASP.Response.Write " &#060;/body&#062;"<BR> objASP.Response.Write "&#060;/html&#062;"<BR>End Sub<BR><BR>-----------------------------------------------------------<BR><BR>I have the refernes pointed to Microsoft Active Server Pages Object Library.<BR><BR>But when I try to run it a get an error complaining that the objASP is nothing, so I guess my onStartPage never runs.<BR><BR>Thanks<BR>Magnus<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Problem writting out from a VB dll

    You&#039re propably creating a class from within the same project as an object in another class of that project.<BR><BR>This gives some problems when you&#039re debugging. The ScriptingContext cannot be used when you&#039re debugging projects that have inter-class object-creation (you&#039re creating one class from the other..).<BR><BR>The SC doesn&#039t provide a context-wrapper for the second created class and therefore lacks access to the ASP intrinsic objects.<BR><BR>The solution? tough one; you can use Server.CreateObject in the first class to force the creation of a new context-wrapper for the second class. This isn&#039t a very good solution, you&#039ll find the answer in the ObjectContext (enough good arts about that).<BR><BR>The problem with the OC is that it&#039s impossible to debug your application because the OC isn&#039t initialized in debug-mode. You can debug, until you start using the ASP intrinsic objects -&#062; they return nothing too.<BR><BR>The only solution that allows debugging is the one with Server.CreateObject. You may want to consult some articles by Doug Dean over at He has some great articles about "Conditionally compiling objects with OC/SC" (or something like that).<BR><BR>good luck.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts