当前位置:首页 > ASP > 正文内容

ASP查看所有Application和Session变量的方法

canca16年前 (2010-02-27)ASP456
<%@ 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 & "
"
  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>






<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>


你可以修改这个程序将所有Application清除

Session变量清除很简单:Session.Abound

扫描二维码推送至手机访问。

版权声明:本文由Ant.Master's Blog发布,如需转载请注明出处。

本文链接:https://iant.work/post/307.html

标签: ASP
分享给朋友:

“ASP查看所有Application和Session变量的方法” 的相关文章

ASP生成JSON

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%><!--#include file="json.asp"--><!--#include file="inc/Conn.asp" --><...

在ASP中操作HTTP报头方法分析

 我们已经在几处见到ASP如何创建或修改在响应页面请示时被发送到客户的HTTP报头。在Response对象中有几个属性和方法可帮助我们做到一点。下面是一些报头方法:  · 控制缓存和有效期。  · 创建状态和定制的HTTP报头。  · 指定MIME类型或内容类型。  · 添加PICS标签。  接下来...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。