Debugging ASP DLL's 
Author Message
 Debugging ASP DLL's

How is it possible to debug a VB DLL that is being called from an ASP page
and is being passed a scripting context from the page ??

Any suggestions much appreciated !!

Regards,

Karl Butcher
Monsoon Malabar Limited

www.monsoonmalabar.com



Thu, 14 Aug 2003 03:03:48 GMT  
 Debugging ASP DLL's
Karl,

The use of OnStartPage() / OnEndPage() to access the ScriptingContext is no
longer the recommended way to access the IIS intrinsic objects in IIS 4.0
and above.   Instead you should be using the GetObjectContext() method.

Debuging under VB presents a problem though because the component is being
run out of process (in VB6.exe), so the call to GetObjectContext will always
fail.  To remedy this, you must use the depreciated OnStartPage() method in
your VB component and Server.CreateObject(...) in your ASP code.
Server.CreateObject passes the ScriptingContext (containing references to
the ASP Intrinsic objects) to your component via the OnStartPage(Object)
method.

So, in example:

Create a new ActiveX dll and add references to the type libraries "Microsoft
Active Server Pages Object Library" and "Com+ Services Type Library".  In
the class of choice, place the following code, which use a conditional
compilation constant to include the appropriate code based on if your using
a compiled DLL or debugging from the IDE.  You must change DEBUG_MODE from
True to False to use the GetObjectContext functionality when you are ready
to compile the component into a DLL:

Option Explicit

#Const DEBUG_MODE = True

#If DEBUG_MODE Then
Dim m_objScriptingContext As ScriptingContext

Public Sub OnStartPage(ScriptingContext As Object)
    Set m_objScriptingContext = ScriptingContext
End Sub

Public Sub OnEndPage()
    Set m_objScriptingContext = Nothing
End Sub
#End If

Public Sub WriteResponse()
    Dim objResponse As Response
#If DEBUG_MODE Then
    Set objResponse = m_objScriptingContext.Response
#Else
    Set objResponse = GetObjectContext("Response")
#End If

    objResponse.Write "<h1>Hello Karl Butcher</h1>"

    Set objResponse = Nothing
End Sub

And in an ASP page use the code:

<html>
 <body>
 <%
  Dim objASPObjects
  Set objASPObjects = Server.CreateObject("KarlButcher.ASPObjects")

  objASPObjects.WriteResponse()

 %>
 </body>
</html>

Reference (Unfortunately they are a bit out of date, but still provide
worthwhile pointers)

INFO: Design Guidelines for VB Components Under ASP
http://support.microsoft.com/support/kb/articles/Q243/5/48.ASP

ASP Component Guidelines
http://msdn.microsoft.com/workshop/server/asp/server01242000.asp

HOWTO: Obtain ObjectContext with ObjectControl Inside VB COM DLL From ASP
and MTS
http://support.microsoft.com/support/kb/articles/Q238/2/74.ASP


Quote:
> How is it possible to debug a VB DLL that is being called from an ASP page
> and is being passed a scripting context from the page ??

> Any suggestions much appreciated !!

> Regards,

> Karl Butcher
> Monsoon Malabar Limited

> www.monsoonmalabar.com



Thu, 14 Aug 2003 05:07:32 GMT  
 Debugging ASP DLL's
I like to pass a param to the component

the VBobject  contains for instance:
Sub Init (Byval iApp as IApplicationObject, Byval IResp as IResponse etc)
End Sub

--
Session management for webfarms:
http://www.nieropwebconsult.nl/asp_session_manager.htm

Quote:
> How is it possible to debug a VB DLL that is being called from an ASP page
> and is being passed a scripting context from the page ??

> Any suggestions much appreciated !!

> Regards,

> Karl Butcher
> Monsoon Malabar Limited

> www.monsoonmalabar.com



Thu, 14 Aug 2003 06:59:26 GMT  
 Debugging ASP DLL's
Hi,

I recommend you to try Team Remote De{*filter*}, you will see that it's easier
and much more
healthy that way :)

Team Remote De{*filter*} 2001 allows you and your team to trace any number of
code units of any kind (ASP,MTS,ISAPI,ActiveX Exe,DLL,COM,COM+,T-SQL Stored
procedures,Threads,CFML), written in any language
(ASP,VB,VC++,VJ,T-SQL,CFML,Delphi) residing on multiple shared and dedicated
servers at the same time fast, easy, simply and reliably!

Check it out & test-drive it here:
http://www.*-*-*.com/ {*filter*}.com/Team_Remote_De{*filter*}.asp

Good luck and take care,

Art
Software Architect
Spline Technologies Corp.
http://www.*-*-*.com/ {*filter*}.com/Index.asp


Quote:
> I like to pass a param to the component

> the VBobject  contains for instance:
> Sub Init (Byval iApp as IApplicationObject, Byval IResp as IResponse etc)
> End Sub

> --
> Session management for webfarms:
> http://www.*-*-*.com/


> > How is it possible to debug a VB DLL that is being called from an ASP
page
> > and is being passed a scripting context from the page ??

> > Any suggestions much appreciated !!

> > Regards,

> > Karl Butcher
> > Monsoon Malabar Limited

> > www.monsoonmalabar.com



Sat, 23 Aug 2003 00:53:16 GMT  
 Debugging ASP DLL's
Hi,

I recommend you to try Team Remote De{*filter*}, you will see that it's easier
and much more
healthy that way :)

Team Remote De{*filter*} 2001 allows you and your team to trace any number of
code units of any kind (ASP,MTS,ISAPI,ActiveX Exe,DLL,COM,COM+,T-SQL Stored
procedures,Threads,CFML), written in any language
(ASP,VB,VC++,VJ,T-SQL,CFML,Delphi) residing on multiple shared and dedicated
servers at the same time fast, easy, simply and reliably!

Check it out & test-drive it here:
http://www.*-*-*.com/ {*filter*}.com/Team_Remote_De{*filter*}.asp

Good luck and take care,

Art
Software Architect
Spline Technologies Corp.
http://www.*-*-*.com/ {*filter*}.com/Index.asp


Quote:
> How is it possible to debug a VB DLL that is being called from an ASP page
> and is being passed a scripting context from the page ??

> Any suggestions much appreciated !!

> Regards,

> Karl Butcher
> Monsoon Malabar Limited

> www.monsoonmalabar.com



Sat, 23 Aug 2003 00:55:25 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. debugging dll's and ocx's

2. Can't debug ASP/COM components from VB6

3. Debug VB.NET DLL(Class Library) from ASP.NET page

4. VB 6.0 DLL debugging from ASP in Windows 2003 Server

5. Debug a vb dll in asp

6. Debugging VB dll through my ASP page

7. Debug VB DLL (Design Mode) with ASP/IIS 5.0

8. Debug VB DLL (Design Mode) with ASP/IIS 5.0

9. Debugging VB dll sitting in COM+, called by ASP

10. Debugging VB6 dll for ASP page

11. VB 6.0 DLL debugging from ASP/IIS 6.0 in Windows 2003 Server

12. Debugging ActiveX DLL from ASP

 

 
Powered by phpBB® Forum Software