<%@ Language=VBScript %> <% Response.Status="301 Moved Permanently" Response.AddHeader "Location", "http://www.dlss.ca/ASP_Debug_info.asp" %> DLSS - Products


Want to be informed
of any product additions?
Sign up Now!
 

First Name

Last Name

Email

privacy policy

   
• Outputting Debug Information via ASP


Whoever that has ever programmed a complex ASP page or application has faced the problem of not being able to debug the results. But there is a way we can easily output all the main variables that will allow us to see why we are not getting the desired results when the code is correct (no syntax errors).

The way to do it is including a file that displays the following information:

  • Session variables
  • Application variables
  • Request Form
  • Request QueryString
  • others...

Include file (debug.asp):

<% Dim IsDebug
IsDebug = True 'Enable

If IsDebug = True Then %>
<BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>

<hr size=1 noshadow>
<b>Debug data:</b>
<TABLE><TR BGCOLOR="#C0C0C0"><TD WIDTH="60%">
<B>Session:</B></TD><TD><B>Application:
</B></TD></TR><TR><TD>
<%
For each field in Session.Contents
Response.Write ("<B>" & field & "</B>: " _
& Session.Contents(field) & "<BR>")
Next
%>
</TD><TD valign=top>
<%
For each field in Application.Contents
Response.Write ("<B>" & field & "</B>: " _
& Application.Contents(field) & "<BR>")
Next
%>
</TD></TR>
</TABLE>
<TABLE width=100%><TR BGCOLOR="#C0C0C0"><TD colspan=2><B>
GET/POST Data:</B></TD></TR>
</TABLE>
<TABLE>
<TR><TD>
<B>Action: </B><BR>
<B>CMD: </B><BR>
<B>QueryString: </B><BR>
<B>Form: </B>
</TD><TD>
<%= Request.Form ("Action") %><br>
<%= Request.QueryString ("cmd") %><br>
<%= Request.QueryString %><br>
<%= Request.Form %>
</TD></TR></TABLE>

<% End If %>

Download the text file here.

Now we only need to add the following wherever we want to get all the data:

<!--#include file="debug.asp"-->

And that's all. I am sure you will find it very useful.

 

Bookmark Us | Privacy Statement | Submit Link ©2004 DataLinks Software Solutions. All rights reserved

Ecommerce Templates Brand Name Clothing Online Casino Games Taser Guns