将ASP的Debug变得简单的两个函数

 1   
 2'---------------------------------------------------------------------------   
 3' 程序作用:打印request.form输入的所有值   
 4'---------------------------------------------------------------------------   
 5Response.Write FormData()   
 6function FormData()   
 7Dim llngMaxFieldIndex   
 8Dim llngFieldIndex   
 9Dim llngMaxValueIndex   
10Dim llngValueIndex   
11Dim lstrDebug   
12' Count Form   
13llngMaxFieldIndex = Request.Form.Count   
14  
15' Let user know if Form Do Not exist   
16if llngMaxFieldIndex = 0 Then   
17FormData = "Form data is empty."   
18Exit function   
19End if   
20  
21' Begin building a list of all Form   
22lstrDebug = "

<ol>"

' Loop through Each Form
For llngFieldIndex = 1 To llngMaxFieldIndex
lstrDebug = lstrDebug &amp; "<li>" &amp; Server.HTMLEncode(Request.Form.Key(llngFieldIndex))

' Count the values
llngMaxValueIndex = Request.Form(llngFieldIndex).Count

' if the Field doesn't have multiple values ...
if llngMaxValueIndex = 1 Then
lstrDebug = lstrDebug &amp; " = "
lstrDebug = lstrDebug &amp; Server.HTMLEncode(Request.Form.Item(llngFieldIndex))
' Else Loop through Each value
Else
lstrDebug = lstrDebug &amp; "<ol>"
For llngValueIndex = 1 To llngMaxValueIndex
lstrDebug = lstrDebug &amp; "<li>"
lstrDebug = lstrDebug &amp; Server.HTMLEncode(Request.Form(llngFieldIndex)(llngValueIndex))
lstrDebug = lstrDebug &amp; "</li>"
Next
lstrDebug = lstrDebug &amp; "</ol>"
End if
lstrDebug = lstrDebug &amp; "</li>"
Next
lstrDebug = lstrDebug &amp; "</ol>

1"   
2' Return the data   
3FormData = lstrDebug   
4  
5End function 
 1   
 2'-------------------------------------------------------------------------   
 3' 函数功能:输出所有输入request.querystring值,用于调试!   
 4'------------------------------------------------------------------------- 
 5
 6Response.Write QueryStringData()   
 7function QueryStringData()   
 8Dim llngMaxFieldIndex   
 9Dim llngFieldIndex   
10Dim llngMaxValueIndex   
11Dim llngValueIndex   
12Dim lstrDebug   
13' Count QueryString   
14llngMaxFieldIndex = Request.QueryString.Count   
15  
16' Let user know if QueryString Do Not exist   
17if llngMaxFieldIndex = 0 Then   
18QueryStringData = "QueryString data is empty."   
19Exit function   
20End if   
21  
22' Begin building a list of all QueryString   
23lstrDebug = "

<ol>"

' Loop through Each QueryString
For llngFieldIndex = 1 To llngMaxFieldIndex
lstrDebug = lstrDebug &amp; "<li>" &amp; Server.HTMLEncode(Request.QueryString.Key(llngFieldIndex))

' Count the values
llngMaxValueIndex = Request.QueryString(llngFieldIndex).Count

' if the Field doesn't have multiple values ...
if llngMaxValueIndex = 1 Then
lstrDebug = lstrDebug &amp; " = "
lstrDebug = lstrDebug &amp; Server.HTMLEncode(Request.QueryString.Item(llngFieldIndex))
' Else Loop through Each value
Else
lstrDebug = lstrDebug &amp; "<ol>"
For llngValueIndex = 1 To llngMaxValueIndex
lstrDebug = lstrDebug &amp; "<li>"
lstrDebug = lstrDebug &amp; Server.HTMLEncode(Request.QueryString(llngFieldIndex)(llngValueIndex))
lstrDebug = lstrDebug &amp; "</li>"
Next
lstrDebug = lstrDebug &amp; "</ol>"
End if
lstrDebug = lstrDebug &amp; "</li>"
Next
lstrDebug = lstrDebug &amp; "</ol>

1"   
2' Return the data   
3QueryStringData = lstrDebug   
4  
5End function 
Published At
Categories with Web编程
Tagged with
comments powered by Disqus