//程序代码w7-10.aspx
<html>
<script language="c#" runat=server>
   private void Page_Load(object sender, System.EventArgs e){
         int i;
         string tStr;
         string sStr;
         string[] strArray;
         HttpStaticObjectsCollection ObCol;
         if (! IsPostBack){
	//浏览器第一次调用本页时初始化变量
	//为防止其他变量干扰，使用前清掉所有的保存变量
Application.RemoveAll();
	for(i=1;i<=4;i++) { 	//保存四个变量
	    tStr="变量名" + i.ToString();
	    sStr="内容" + i.ToString();
	    Application[tStr]=sStr;
	}
}
  else
  {       //采用item属性遍历
	  Response.Write("<center><b>采用item属性显示</b></center><br>");    
	  strArray=Application.AllKeys;
	  for(i=1;i<= Application.Count;i++) {
	  	tStr= strArray[i-1] + "=" + Application[i-1] +"&nbsp;&nbsp;"; 
		Response.Write(tStr);
	  }
	  //显示有多少个object定义
	  ObCol=Application.StaticObjects;
	  Response.Write("<hr>含有object标识：" + ObCol.Count + "个");
	}
	  }
 </script>
<head>
  <title>  Appliction对象试验  </title>
</head>
<body bgcolor=#ccccff>
<center>
   <h2>Appliction对象试验</h2>
<hr>
<form runat=server>
	<asp:button text="显示Appliction内容" runat=server />
</form>
</center>
</body>
</html>
