Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning values from MTS to an ASP

Status
Not open for further replies.

ctyson

Programmer
Oct 17, 2001
2
GB
Hi

Don't know if its just me being a bit silly but I have a component which is invoked by an ASP, does some DB, DCOM stuff etc. and then returns a value (string) to the ASP page for display.

The problem is, I'm unit testing this component and passing it invalid input to make it error and test my error routines. What should happen, and does when I run in debug mode, is that the component enters my error handler and returns a string msg. However, when I run the component without debug, the component returns nothing.

Can anyone tell me what I'm doing wrong!!!???

Thanks

C

 
How do you have the project properties set: "Break on all errors"?

Chip H.
 
Chip

Thanks for the reply but I'm not sure I understand the question, could you elaborate please..!

Cheers

Chris
 
I guess run in debug mode means that you are running the project in design mode (pressing F5 or play).
Not running the project in debug mode means you`ve compiled it.
Do you have an On Error statement in your errorhandler. If you consider the code below you would think the msgbox would say 55 but it will give 0 as if no error ocurred:
On Error GoTo arr
Err.Raise 55

arr:
On Error GoTo 0
MsgBox Err.Number

Anyway returning the error to the asp page will not happen because the error number is 0.
If you pass the response object when you call the com component you can let the component write the error for you like so:
(set a ref to the com component from asp)
dim objMyComponent
set objMyComponent = server.createobject("myproject.myclass")
objMyComponent.myPublicSub Response

(in the com component set a reference to Microsoft Active Server Pages Object Library)
public sub myPublicSup(objMyResponse As Response)
err.raise 55

arr:
objMyResponse.write &quot;Sorry an error ocured &quot; & err.description & &quot;<br>Error code: &quot; & err.number

If you run your component in MTS you can set the ObjectContext and you do not need to pass the response from asp to the com component.
I can explain how to do it if you need it but not now.

Hope this helps a little and good luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top