復制代碼 代碼如下:
一 遍歷Request
方式1:
<%
For Each r In Request.QueryString
Response.Write "Request("""&r&""") = " & Request(r)
Response.Write "<p>"
Next
%>
方式2:
<%
For i = 1 To Request.QueryString.Count
Response.Write "Request("""&Request.QueryString.Key(i)&""") = " & Request.QueryString(Request.QueryString.Key(i))
Response.Write "<p>"
Next
%>
將QueryString改為Form,即可遍歷Post變量。
二 遍歷Session
<%
Session("key1")="value1"
Session("key2")="value2"
For Each s In Session.Contents
Response.Write "Session("""&s&""") = " & Session(s)
Response.Write "<p>"
Next
%>
三 遍歷Application
<%
Application("key1")="value1"
Application("key2")="value2"
For Each a In Application.Contents
Response.Write "Application("""&a&""") = " & Application(a)
Response.Write "<p>"
Next
%>