将ASP的Debug变得简单的两个函数
时间:2009-06-24 17:04:03
作者:互联网
<%
'---------------------------------------------------------------------------
' 程序作用:打印re***st.form输入的所有值
'---------------------------------------------------------------------------
Re***nse.Write FormData()
function FormData()
Dim llngMaxFieldIndex
Dim llngFieldIndex
Dim llngMaxValueIndex
Dim llngValueIndex
Dim lstrDebug
' Count Form
llngMaxFieldIndex = Re***st.Form.Count
' Let user know if Form Do Not exist
if llngMaxFieldIndex = 0 Then
FormData = "Form data is empty."
Exit function
End if
' Begin building a list of all Form
lstrDebug = "
"
' Loop through Each Form
For llngFieldIndex = 1 To llngMaxFieldIndex
lstrDebug = lstrDebug & "- " & Se***r.HTMLEncode(Re***st.Form.Key(llngFieldIndex))
' Count the values
llngMaxValueIndex = Re***st.Form(llngFieldIndex).Count
' if the Field doesn't have multiple values ...
if llngMaxValueIndex = 1 Then
lstrDebug = lstrDebug & " = "
lstrDebug = lstrDebug & Se***r.HTMLEncode(Re***st.Form.Item(llngFieldIndex))
' Else Loop through Each value
Else
lstrDebug = lstrDebug & ""
For llngValueIndex = 1 To llngMaxValueIndex
lstrDebug = lstrDebug & "- "
lstrDebug = lstrDebug & Se***r.HTMLEncode(Re***st.Form(llngFieldIndex)(llngValueIndex))
lstrDebug = lstrDebug & " "
Next
lstrDebug = lstrDebug & "
"
End if
lstrDebug = lstrDebug & " "
Next
lstrDebug = lstrDebug & "
"
' Return the data
FormData = lstrDebug
End function
%>
<%
'-------------------------------------------------------------------------
' 函数功能:输出所有输入re***st.querystring值,用于调试!
'-------------------------------------------------------------------------
Re***nse.Write QueryStringData()
function QueryStringData()
Dim llngMaxFieldIndex
Dim llngFieldIndex
Dim llngMaxValueIndex
Dim llngValueIndex
Dim lstrDebug
' Count QueryString
llngMaxFieldIndex = Re***st.QueryString.Count
' Let user know if QueryString Do Not exist
if llngMaxFieldIndex = 0 Then
QueryStringData = "QueryString data is empty."
Exit function
End if
' Begin building a list of all QueryString
lstrDebug = "
"
' Loop through Each QueryString
For llngFieldIndex = 1 To llngMaxFieldIndex
lstrDebug = lstrDebug & "- " & Se***r.HTMLEncode(Re***st.QueryString.Key(llngFieldIndex))
' Count the values
llngMaxValueIndex = Re***st.QueryString(llngFieldIndex).Count
' if the Field doesn't have multiple values ...
if llngMaxValueIndex = 1 Then
lstrDebug = lstrDebug & " = "
lstrDebug = lstrDebug & Se***r.HTMLEncode(Re***st.QueryString.Item(llngFieldIndex))
' Else Loop through Each value
Else
lstrDebug = lstrDebug & ""
For llngValueIndex = 1 To llngMaxValueIndex
lstrDebug = lstrDebug & "- "
lstrDebug = lstrDebug & Se***r.HTMLEncode(Re***st.QueryString(llngFieldIndex)(llngValueIndex))
lstrDebug = lstrDebug & " "
Next
lstrDebug = lstrDebug & "
"
End if
lstrDebug = lstrDebug & " "
Next
lstrDebug = lstrDebug & "
"
' Return the data
QueryStringData = lstrDebug
End function
%>