Debugging VB dll through my ASP page 
Author Message
 Debugging VB dll through my ASP page

I'm somewhat new to developing components to handle all logic associated
with web applications.  I've been doing ASP for some time now and I'm very
familiar with that aspect.  The problem I'm running into is in debugging VB
COM components in my ASP page.  Specifically, I would like to retrieve the
line number of the error (I've been able to retrieve the description, but
that doesn't help much in this case(it's way too vague)).  I someone has
some techniques as to how they do this (since I'm sure other people out
there have run into this too), it would be greatly appreciated.

Justin



Sun, 07 Mar 2004 23:57:35 GMT  
 Debugging VB dll through my ASP page
Justin,

In the error handler of your VB component you can reference the
mostly-undocumented feature Erl.  Use this code:
    lngErrorLine = Erl

Be sure to access this before your procedure or method loses scope (i.e.,
external function to log errors to NT Event Log, etc) otherwise Erl becomes
0 regardless of where the error occurred.

After grabbing the error line place it into Err.Source along with
Err.Source's original values then bubble up the error to ASP using
Err.Raise.
Just one example:
    Err.Source = Err.Source & vbCr & "Error at Line: " & lngErrorLine

Hope this helps.

Jason


Quote:
> I'm somewhat new to developing components to handle all logic associated
> with web applications.  I've been doing ASP for some time now and I'm very
> familiar with that aspect.  The problem I'm running into is in debugging
VB
> COM components in my ASP page.  Specifically, I would like to retrieve the
> line number of the error (I've been able to retrieve the description, but
> that doesn't help much in this case(it's way too vague)).  I someone has
> some techniques as to how they do this (since I'm sure other people out
> there have run into this too), it would be greatly appreciated.

> Justin



Mon, 08 Mar 2004 02:14:48 GMT  
 Debugging VB dll through my ASP page
Jason
Thanks man...  I'll try it now..  If it works, you are a major life-saver..

Justin


Quote:
> Justin,

> In the error handler of your VB component you can reference the
> mostly-undocumented feature Erl.  Use this code:
>     lngErrorLine = Erl

> Be sure to access this before your procedure or method loses scope (i.e.,
> external function to log errors to NT Event Log, etc) otherwise Erl
becomes
> 0 regardless of where the error occurred.

> After grabbing the error line place it into Err.Source along with
> Err.Source's original values then bubble up the error to ASP using
> Err.Raise.
> Just one example:
>     Err.Source = Err.Source & vbCr & "Error at Line: " & lngErrorLine

> Hope this helps.

> Jason



> > I'm somewhat new to developing components to handle all logic associated
> > with web applications.  I've been doing ASP for some time now and I'm
very
> > familiar with that aspect.  The problem I'm running into is in debugging
> VB
> > COM components in my ASP page.  Specifically, I would like to retrieve
the
> > line number of the error (I've been able to retrieve the description,
but
> > that doesn't help much in this case(it's way too vague)).  I someone has
> > some techniques as to how they do this (since I'm sure other people out
> > there have run into this too), it would be greatly appreciated.

> > Justin



Mon, 08 Mar 2004 02:43:09 GMT  
 Debugging VB dll through my ASP page
Justin,

If you don't already know, Interdev and the Visual Studio VB will also
work together for debugging. Make sure the dll isn't loaded into the
inetinfo process (restart if necessary), in VB make sure the project
settings are binary compatable, set a break point if needed, and do a
run with full compile (CTRL+F5). Then open the asp page. You
should then be able to step through the VB code in VB environment.

One gotcha is (under 2000, as far as I'm aware) is you need to
set IUSR_machinename access using dcomcnfg (run from the
command line, look under default security, then edit default access
permissions and add the IUSR_mn account. Don't do this on a
public access machine.

Rgds
Peter


Quote:
> I'm somewhat new to developing components to handle all logic associated
> with web applications.  I've been doing ASP for some time now and I'm very
> familiar with that aspect.  The problem I'm running into is in debugging
VB
> COM components in my ASP page.  Specifically, I would like to retrieve the
> line number of the error (I've been able to retrieve the description, but
> that doesn't help much in this case(it's way too vague)).  I someone has
> some techniques as to how they do this (since I'm sure other people out
> there have run into this too), it would be greatly appreciated.

> Justin



Mon, 08 Mar 2004 03:32:06 GMT  
 Debugging VB dll through my ASP page
Justin,

In the error handler of your VB component you can reference the
mostly-undocumented feature Erl.  Use this code:
    lngErrorLine = Erl

Be sure to access this before your procedure or method loses scope (i.e.,
external function to log errors to NT Event Log, etc) otherwise Erl becomes
0 regardless of where the error occurred.

After grabbing the error line place it into Err.Source along with
Err.Source's original values then bubble up the error to ASP using
Err.Raise.
Just one example:
    Err.Source = Err.Source & vbCr & "Error at Line: " & lngErrorLine

Hope this helps.

Jason


Quote:
> I'm somewhat new to developing components to handle all logic associated
> with web applications.  I've been doing ASP for some time now and I'm very
> familiar with that aspect.  The problem I'm running into is in debugging
VB
> COM components in my ASP page.  Specifically, I would like to retrieve the
> line number of the error (I've been able to retrieve the description, but
> that doesn't help much in this case(it's way too vague)).  I someone has
> some techniques as to how they do this (since I'm sure other people out
> there have run into this too), it would be greatly appreciated.

> Justin



Mon, 08 Mar 2004 02:14:48 GMT  
 Debugging VB dll through my ASP page
Hi Justin,

try this:

Public Sub Main()
38  On Error GoTo err_handler
39  MsgBox "before"
40  MsgBox 1 / 0
41  MsgBox "after"
err_handler:
42  If Err.Number <> 0 Then MsgBox "Error in line " & Erl
End Sub

There are plenty of tools for line numbering. You can download a free one
with source code from my home page:
http://www.angelfire.com/home/dmzakharov/

Regards,
Dmitriy Zakharov.
Brainbench MVP for Visual Basic
http://www.brainbench.com


Quote:
> I'm somewhat new to developing components to handle all logic associated
> with web applications.  I've been doing ASP for some time now and I'm very
> familiar with that aspect.  The problem I'm running into is in debugging
VB
> COM components in my ASP page.  Specifically, I would like to retrieve the
> line number of the error (I've been able to retrieve the description, but
> that doesn't help much in this case(it's way too vague)).  I someone has
> some techniques as to how they do this (since I'm sure other people out
> there have run into this too), it would be greatly appreciated.

> Justin



Tue, 09 Mar 2004 18:03:35 GMT  
 Debugging VB dll through my ASP page
yes - this works really well.

A few pointers for step through into VB COM objects from Interdev:

You need the server-side tools install of visual studio to get interdev to
do step-through debugging (disk 2 of 3).

There is a registry tweak to get the VB ASP Debugging process to appear in
DCOMCNFG. This is where you need to apply those security settings Peter is
talking about below.

Don't reference your COM object in Interdev's "Project references" section.
I have never got this to work. Interdev can step through into a (late-bound)
COM object without a reference. I think this is very clever - though I
expect there are some VB/system gurus out there who might assure me its all
very simple....

search the Microsoft Knowledge base for help on step through into VB Com
objects from interdev. Mail me if you need the registry tweak -

hope this helps

Ralph


Quote:
> Justin,

> If you don't already know, Interdev and the Visual Studio VB will also
> work together for debugging. Make sure the dll isn't loaded into the
> inetinfo process (restart if necessary), in VB make sure the project
> settings are binary compatable, set a break point if needed, and do a
> run with full compile (CTRL+F5). Then open the asp page. You
> should then be able to step through the VB code in VB environment.

> One gotcha is (under 2000, as far as I'm aware) is you need to
> set IUSR_machinename access using dcomcnfg (run from the
> command line, look under default security, then edit default access
> permissions and add the IUSR_mn account. Don't do this on a
> public access machine.

> Rgds
> Peter



> > I'm somewhat new to developing components to handle all logic associated
> > with web applications.  I've been doing ASP for some time now and I'm
very
> > familiar with that aspect.  The problem I'm running into is in debugging
> VB
> > COM components in my ASP page.  Specifically, I would like to retrieve
the
> > line number of the error (I've been able to retrieve the description,
but
> > that doesn't help much in this case(it's way too vague)).  I someone has
> > some techniques as to how they do this (since I'm sure other people out
> > there have run into this too), it would be greatly appreciated.

> > Justin



Sat, 13 Mar 2004 18:17:21 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Debugging VB dll through my ASP page

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

3. Debug Problem connecting between ASP pages on website and VB DLL

4. Debugging VB6 dll for ASP page

5. Help! - debugging VB Components - triggered from ASP Page

6. Debugging VB controls from ASP Pages.

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

8. Debug a vb dll in asp

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

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

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

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

 

 
Powered by phpBB® Forum Software