Debugging VB dll through my ASP page
Author |
Message |
Justin Furc #1 / 8
|
 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 |
|
 |
Jason Baile #2 / 8
|
 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 |
|
 |
Justin Furc #3 / 8
|
 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 |
|
 |
Peter Johnsto #4 / 8
|
 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 |
|
 |
Jason Baile #5 / 8
|
 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 |
|
 |
Dmitriy Zakharo #6 / 8
|
 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 |
|
 |
Ralph Weedo #7 / 8
|
 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 |
|
 |
john #8 / 8
|
 Debugging VB dll through my ASP page
Unfortunately you've stumbled across possibly one of the most tedious and unfriendly aspects to web development. Certain versions of software will not allow you to debug from ASP to VB objects. This is of course assuming you are using Visual Interdev to develop the ASP side of the application. Or you've already created the ASP side and just want to step through your VB code. For debug in ASP and Step into VB you need: IE 4.0 NT 4.0 SP 4 MS Script De{*filter*} Option Pack 4.0 IIS 4.0 Visual Interdev FrontPage 2000 Server Extensions SR 2 --This seems wierd, but its the only way i could ever get it to work flawlessly --You also have to make sure that you have "run in seperate memory space" selected for the web application properties under IIS. Also, when in interdev, select app debugging check box under the project properties. Once you set your breakpoint in Interdev on the ASP code that calls your object, you will step into your VB code. Of course you have to have that .dll open and running in VB. you can find more information in MSDN, but its outdated and some of it doesn't work any longer. The best case is to just create a project group and simulate data passed to your object from the second application. That way you can create easy testing scenerios.
|
Wed, 31 Mar 2004 04:11:52 GMT |
|
|
|