Asp遍历服务器对象的代码
程序员文章站
2022-07-01 23:45:43
复制代码 代码如下:一 遍历request 方式1: <% for each r in request.querys...
复制代码 代码如下:
一 遍历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
%>
下一篇: 移动端常见问题处理