热门文章
 
ASP内建对象Server
Global.asa文件的使
ASP内建对象Applica
访问和更新Cookies集合
Asp:Cookie集合 简
asp中cookie使用示例
Asp:Cookie集合简介
遍历cookies的方法
判断cookie是否开启
cookies读写基本例子
 推荐文章
 
ASP Session 对象
松子谈asp的Request
再总结一下asp重定向的方法
asp:Session St
session的使用与性能:
asp session 使用
asp中session具体是
防止ASP Session丢
Asp提高首页性能的一个技巧
ASP禁止刷新当前页
asp清空session 关
TypeLibrary 声明
cookies和sessio
web开发:Session详
ASP中Session技巧
再谈asp中的Server.
 
你现在的位置:您现在的位置是: 中国ASP>>ASP教程>>ASP对象
显示ASP 中所有的Session 变量

下面的代码 用来把Asp中所有的Session变量显示出来

<%@ LANGUAGE="VBSCRIPT" %>
<%
'#####################################################
'Function:
' List server Session variable & Application variable
'Author: Hardy He
'Date: 2003-3-12 23:30
'Memo: Be care for diffrent virtul path show diffrent Session
'#####################################################
%>
<table border="2" cellspacing="1" bordercolor="#800000" width="100%" id="AutoNumber1" bordercolorlight="#808080" bordercolordark="#FFFFFF" height="37" bgcolor="#D6D3CE">
<%
Dim sessitem


response.write "SessionID: " & Session.SessionID & "<br>"
response.write "List of " & Session.Contents.Count & " items in Session contents collection: "


intItem=1
For Each sessitem in Session.Contents
response.write "<tr>"
If IsObject(Session.Contents(sessitem)) Then
Response.Write "<td>"+CStr(intItem) + "</td>"
Response.Write "<td>"+sessitem+ "</td>"
Response.Write "<td>"+"Session object"+ "</td>"
Else
If IsArray(Session.Contents(sessitem)) Then
Response.Write "<td>"+CStr(intItem) + "</td>"
Response.Write "<td>"+"Array Object "+ "</td>" + "<td>"

For each objArray in Session.Contents(sessitem)
Response.Write "***;"
Next
Response.Write "</td>"

Else
Response.Write "<td>"+CStr(intItem) + "</td>"
Response.Write "<td>"+ sessitem + "</td>"
Response.Write "<td>"+ CStr(Session.Contents(sessitem)) + "</td>"
End If
End If
response.write "</tr>"
intItem=intItem+1
Next

%>
</table>

<br>
<hr>
LIST Application

<hr>
<table border="2" cellspacing="1" bordercolor="#800000" width="100%" id="AutoNumber1" bordercolorlight="#808080" bordercolordark="#FFFFFF" height="37" bgcolor="#D6D3CE">
<%

intItem=1
For Each Key in Application.Contents

Response.Write "<tr>"
If IsObject(Application.Contents(intItem)) Then

Response.Write "<td>"+CStr(intItem) + "</td>"
Response.Write "<td>"+CStr(Key) + "</td>"
Response.Write "<td>"+"Object" + "</td>"

Else
Response.Write "<td>"+CStr(intItem) + "</td>"
Response.Write "<td>"+CStr(Key) + "</td>"
Response.Write "<td>"+CStr(Application.Contents(intItem)) + "</td>"
End If
intItem=intItem+1
Response.Write "</tr>"

Next

%>
</table>


相关信息:

ASP内建对象Application和Session
Cookie,Session,Application封装
Session与Cookie区别
再谈cookies和session的关系
罗列全部session和application
ASP的Application对象和Session对象
创建Variant数组
ASP中使用Session变量的优缺点
计算session和application的数量

 

中国ASP技术 ASP.ORG.CN 版权所有 2004-2008