当前位置:首页 > ASP

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

canca16年前 (2010-02-27)ASP510
<%@ 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读写UTF-8格式文件

最近一个项目用到这个,为什么呢?因为要用ASP文件来修改ASP文件,也就是说在代码中动态的修改要执行的ASP文件,由于项目是多语种的,所以,最终选用UTF-8统一编码开始尝试用ASP的FSO对象来完成,在尝试过无数次后,终于死心,FSO对象只能…

如何提高ASP数据查询执行效率

1 明确查询的字段名称2 使用rs(0)比rs(“name”)更快3 使用记录集rs值前,将其赋值给变量4 [TEST] 现有10W条数据,Access数据库保存通过正常提取 | 通过存储过程提取| 使用GetRows()方法提取: 1 明确查询的字段名称 Select * from [data_t…

asp控制xml数据库的6段代码

NO.1--建立一个XML数据库data.xml <?xml version="1.0"?><records><record><name>caca</name><qq>154222225</qq><email&…

Replace,Instr函数不区别大小写的方法

有时候感觉互联网是万能的,什么答案都能到,但还是有时候不能直接找到答案,要靠自己去解决。 VB语言里Replace函数如何不区别大小写是很多问的问题,但网上难得看到好答案,一般都是用正则表达式,其实此函数本身就有忽...…

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

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

发表评论

访客

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