Data Access Worldwide Knowledge Base

Article ID 2283
Article Title HOWTO: Debug help for ASP with Cookie print out
Article URL http://www.dataaccess.com/kbasepublic/KBPrint.asp?ArticleID=2283
KBase Category WEB APPLICATIONS
Date Created 01/09/2007
Last Edit Date 01/10/2007


Article Text
The ASP files generated with the Visual DataFlex Web Wizards contain a commented out code line that together with an ASP include instruction show some debug information to you while developing your webapplications. The lines are:

<% ' DebugMode =1 ' uncomment this for page get/post debug help %>
<!-- #INCLUDE FILE="inc/DebugHelp.inc" -->

When you do as instructed (remove the single quote before the word DebugMode) and you instruct the browser to get your ASP document the top of your document contains:

----DEBUG INFORMATION----
content_length = 0
request_method = GET
Querystring =
----END DEBUG INFORMATION----

When the same document is requested with a find next (or any other button action in the form object) the debug information changes to something like:

----DEBUG INFORMATION----
content_length = 183
request_method = POST
Vendor__Rowid=
vendor__id= 0
vendor__name=
vendor__address=
vendor__city=
vendor__state= AK
vendor__zip=
vendor__phone_number=
vendor__fax_number=
ChangedStates=
findlast= >>
Index= 1
Querystring =
----END DEBUG INFORMATION----

As you can see the debug information is extended with the information that was in the input controls of the POSTed form.

Besides form information your page might contain cookie information. If you want this to printed at the page you can open the file DebugHelp.Inc (from the Apphtml\Inc directory) and change the content between "Sub ShowPostGet" and "End Sub" to:

    Dim x, Nam
    response.write ("<hr /><strong>----DEBUG INFORMATION----</strong><br />")
    response.write ("content_length = " + request.servervariables("content_length")+"<br />")
    response.write ("request_method = " + request.servervariables("request_method")+"<br />")
    response.write "------------------------------------<br />"
    response.write "Form values<br />"
    if (request.form.count > 0) then
        For Each x In Request.Form
            set nam = Request.Form(x)
            response.write ("&nbsp;&nbsp;&nbsp;" + x +"= " +nam+"<br />")
        Next
    else
        response.write "&nbsp;&nbsp;&nbsp;NO form values<br />"
    end if
    response.write "------------------------------------<br />"
    response.write "Cookie values<br />"
    if (request.cookies.count > 0) then
        For Each x In Request.Cookies
            set nam = Request.Cookies(x)
            response.write("&nbsp;&nbsp;&nbsp;" + x +"= " +nam+"<br />")
        Next
    else
        response.write "&nbsp;&nbsp;&nbsp;NO cookie values<br />"
    end if
    response.write "------------------------------------<br />"
    response.write ("Querystring = " + request.querystring+"<br />")
    response.write "<strong>----END DEBUG INFORMATION----</strong><hr />"
End Sub

This way both the form values and the cookie values are shown in the debug lines. The output can be something like:

----DEBUG INFORMATION----
content_length = 0
request_method = GET
------------------------------------
Form values
   NO form values
------------------------------------
Cookie values
   8765309= ack=vincent
------------------------------------
Querystring =
----END DEBUG INFORMATION----




Email this Article
Email this Article to a Colleague
Send Feedback on this Article to Data Access Worldwide
Copyright ©2010 Data Access Corporation. All rights reserved.

The information provided in the Data Access Technical Knowledge Base is provided "as is" without warranty of any kind. Data Access Corporation disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. In no event shall Data Access Corporation or its suppliers be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages, even if Data Access Corporation or its suppliers have been advised of the possibility of such damages. Some states do not allow the exclusion or limitation of liability for consequential or incidental damages so the foregoing limitation may not apply.