Debug Local Variables

Discussion in 'ASP General' started by Rigs, Aug 23, 2004.

  1. Rigs

    Rigs Guest

    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
     
    Rigs, Aug 23, 2004
    #1
    1. Advertising

  2. 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




    "Rigs" <> wrote in message
    news:%...
    > 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
    >
    >
     
    Ray Costanzo [MVP], Aug 23, 2004
    #2
    1. Advertising

  3. Rigs

    Rigs Guest

    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


    "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:O5D%...
    > 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
    >
    >
    >
    >
    > "Rigs" <> wrote in message
    > news:%...
    > > 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
    > >
    > >

    >
    >
     
    Rigs, Aug 23, 2004
    #3
  4. 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" <> wrote in message
    news:ek$...
    > 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
    >
    >
    > "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    > message news:O5D%...
    >> 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
    >>
    >>
    >>
    >>
    >> "Rigs" <> wrote in message
    >> news:%...
    >> > 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
    >> >
    >> >

    >>
    >>

    >
    >
     
    Ray Costanzo [MVP], Aug 23, 2004
    #4
  5. Rigs

    Rigs Guest

    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 [MVP]" <my first name at lane 34 dot commercial> wrote in
    message news:...
    > 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" <> wrote in message
    > news:ek$...
    > > 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
    > >
    > >
    > > "Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
    > > message news:O5D%...
    > >> 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
    > >>
    > >>
    > >>
    > >>
    > >> "Rigs" <> wrote in message
    > >> news:%...
    > >> > 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
    > >> >
    > >> >
    > >>
    > >>

    > >
    > >

    >
    >
     
    Rigs, Aug 23, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. RonL
    Replies:
    0
    Views:
    776
  2. Sullivan WxPyQtKinter
    Replies:
    10
    Views:
    706
    Antoon Pardon
    Nov 8, 2007
  3. Replies:
    9
    Views:
    1,008
  4. Tammo Tjarks
    Replies:
    2
    Views:
    303
    Tammo Tjarks
    Sep 13, 2007
  5. king
    Replies:
    2
    Views:
    185
    Tad McClellan
    Jun 27, 2006
Loading...

Share This Page