Asp遍历服务器对象的代码
2018-09-06 11:24
复制代码 代码如下:
一遍历Request
方式1:
<%
ForEachrInRequest.QueryString
Response.WriteRequest(&r&)=&Request(r)
Response.Write<p>
Next
%>
方式2:
<%
Response.WriteRequest(&Request.QueryString.Key(i)&)=&Request.QueryString(Request.QueryString.Key(i))
Response.Write<p>
Next
%>
将QueryString改为Form,即可遍历Post变量。
二遍历Session
<%
Session(key1)=value1
Session(key2)=value2
ForEachsInSession.Contents
Response.WriteSession(&s&)=&Session(s)
Response.Write<p>
Next
%>
三遍历Application
<%
Application(key1)=value1
Application(key2)=value2
ForEachaInApplication.Contents
Response.WriteApplication(&a&)=&Application(a)
Response.Write<p>
Next
%>