Debug Local Variables

R

Rigs

Hi,

Does anyone happen to have a debug script that will display the variable
name and value for all of the local variables on an .asp page? (not session
nor application, as I already have scripts those.) I'm looking for
something that can be included in an .asp to write out values for debugging.
Does anyone know what scope those variables reside in?

Please help if you can.

Thanks,
-Rigs
 
R

Ray Costanzo [MVP]

There is no functionality built in to ASP that will do this for you, no.
You'd have to response.write them where you want them. If your pages just
consist of ASP code not contained in any subs or anything, your vars will
have global scope in the page. So, you could write a function to display
your values and just call that function where you need it.

<%
Dim a, b, c, d

'''code, code, code
Call WriteVals("line 32")

'''code, code, cone
Call WriteVals("Just created e-mail object")

'''code, code, code
Call WriteVals("About to insert data into database."


Function WriteVals(MarkerStatement)
Response.Write "<hr>"
Response.Write MarkerStatment & "<br>"
Response.Write "a=" & a & "<br>"
Response.Write "b=" & b & "<br>"
Response.Write "c=" & c & "<br>"
Response.Write "d=" & d
End Function
%>


Be sure you use Option Explicit.

Ray at work
 
R

Rigs

Ray,

Thanks, but I am looking for more of a collection type solution.
Response.write would be quite tedious for this page. (lots of vars for
calcs and such...)

Is "global" part of a collection? That way I could write out the variables
and their values like I do with the session vars? Below is my session var
code. I am 'hoping' there's an equivalent for local global variables.

Session write out code:
For Each Item in Session.Contents
Response.write Item & " = " & Session.Contents(Item) & "<BR>"
For Each ItemKey in Session.Contents(Item)
Response.Write "Sub Item: " & Item & " (" & ItemKey & ") : " _
& Session.Contents(Item)(ItemKey) & "<br>"
Next
Next

Please let me know your thoughts either way and thanks again for your help.
-Rigs
 
R

Ray Costanzo [MVP]

Unfortunately, no, there is no collection you can itterate through. This
question has come up a number of times, and I do not recall anyone coming up
with anything to solve this need yet. :[

Ray at work
 
R

Rigs

That stinks... But thanks for your input. What was MS thinking when it
left those vars out of a collection, yet placing all other vars in one!?!?
I appreciate your assistance.

Ray Costanzo said:
Unfortunately, no, there is no collection you can itterate through. This
question has come up a number of times, and I do not recall anyone coming up
with anything to solve this need yet. :[

Ray at work

Rigs said:
Ray,

Thanks, but I am looking for more of a collection type solution.
Response.write would be quite tedious for this page. (lots of vars for
calcs and such...)

Is "global" part of a collection? That way I could write out the
variables
and their values like I do with the session vars? Below is my session var
code. I am 'hoping' there's an equivalent for local global variables.

Session write out code:
For Each Item in Session.Contents
Response.write Item & " = " & Session.Contents(Item) & "<BR>"
For Each ItemKey in Session.Contents(Item)
Response.Write "Sub Item: " & Item & " (" & ItemKey & ") : " _
& Session.Contents(Item)(ItemKey) & "<br>"
Next
Next

Please let me know your thoughts either way and thanks again for your
help.
-Rigs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top