<%
Sub print_r(var)
Dim myPrint
Set myPrint = New clsPrint
myPrint.print var, 0
End Sub
Class clsPrint
Public Sub print(var, nIndent)
Dim nType, sTypeName
'Response.Write TypeName(var)
nType = VarType(var)
Select Case nType
Case 0:
Response.Write "(vbEmpty)"
Case 1:
Response.Write "(vbNull)"
Case 2:
Response.Write var & "(vbIngerger)"
Case 3:
Response.Write var & "(vbLong)"
Case 4,5:
Response.Write var & "(vbSingle)"
Case 6:
Response.Write var & "(vbCurrency)"
Case 7:
Response.Write var & "(vbDate)"
Case 8:
Response.Write var & "(vbString)"
Case 9:'vbObject
sTypeName = TypeName(var)
Select Case sTypeName
Case "ISessionObject": 'Session
print_session var, nIndent
Case "IRequest": 'Request
print_request var, nIndent
Case "IApplicationObject": 'Application
print_application var, nIndent
Case Else
Response.Write "Unimpleneted TypeName:" & sTypeName
End Select
Case 10:
Response.Write "(vbError)"
Case 11:
Response.Write var & "(vbBoolean)"
Case 12:
Response.Write "(vbDataObject)"
Case 13:
Response.Write "(vbDecimal)"
Case 14:
Response.Write "(vbByte)"
Case 8192,8204:
print_array var, nIndent + 1
Case Else:
Response.Write "VarType:" & nType
End Select
Response.Write vbCrLf
End Sub
Sub print_array(var, nIndent)
print_list "Array", var, nIndent
End Sub
Sub print_request(var, nIndent)
print_name "Request", nIndent
print_openbrace nIndent
print_dict "Request.Form", var.Form, nIndent + 1
print_dict "Request.QueryString", var.QueryString, nIndent + 1
print_dict "Request.Cookies", var.Cookies, nIndent + 1
print_dict "Request.ServerVariables", var.ServerVariables, nIndent + 1
print_closebrace nIndent
End Sub
Sub print_application(var, nIndent)
print_name "Application", nIndent
print_openbrace nIndent
print_dict "Application.StaticObjects", var.StaticObjects, nIndent + 1
print_dict "Application.Contents", var.Contents, nIndent + 1
print_closebrace nIndent
End Sub
Sub print_session(var, nIndent)
print_name "Session", nIndent
print_openbrace nIndent
print_dict "Session.StaticObjects", var.StaticObjects, nIndent + 1
print_dict "Session.Contents", var.Contents, nIndent + 1
print_closebrace nIndent
End Sub
Sub print_dict(sTypeName, var, nIndent)
Dim sKey
print_name sTypeName, nIndent
print_openbrace nIndent
For Each sKey In var
print_key sKey, nIndent + 1
print var(sKey), nIndent + 1
Next
print_closebrace nIndent
End Sub
Sub print_list(sTypeName, var, nIndent)
Dim vValue, nIndex
Response.Write sTypeName & vbCrLf
print_openbrace nIndent
nIndex = 0
For Each vValue In var
print_key nIndex, nIndent + 1
print vValue, nIndent + 1
nIndex = nIndex + 1
Next
print_closebrace nIndent
End Sub
Private Sub print_name(sName, nIndent)
print_indent nIndent
Response.Write sName & vbCrLf
End Sub
Private Sub print_key(sKey, nIndent)
print_indent nIndent
Response.Write "[" & sKey & "] => "
End Sub
Private Sub print_openbrace(nIndent)
print_indent nIndent
Response.Write "(" & vbCrLf
End Sub
Private Sub print_closebrace(nIndent)
print_indent nIndent
Response.Write ")" & vbCrLf
End Sub
Private Sub print_indent(nIndent)
Response.Write String(nIndent * 4, " ")
End Sub
End Class
' a = "123"
' b = Split("1 2 3 4 5", " ")
' print_r a
' print_r b
' print_r Session
' 'print_r Application
' 'print_r Request
%>
Request("num") : <%=Request("num")%><br>
Request.QueryString("num") : <%=Request.QueryString("num")%><br>
Request.Form("num") : <%=Request.Form("num")%><br><br>
넘어온데이타 전체 찍어보기
<%
Response.Write ("QueryString으로 넘어온값<br>")
For Each item in Request.QueryString
For index_i = 1 To Request.QueryString(item).Count
Response.Write (item & " : " & Request.QueryString(item)(index_i) & "<br>")
Next
Next
Response.Write ("Post로 넘어온값<br>")
For Each item in Request.Form
For index_i = 1 To Request.Form(item).Count
Response.Write (item & " : " & Request.Form(item)(index_i) & "<br>")
Next
Next
%>