有这样一个程序,是对Application集合中的元素进行活动的添加与删除,程序如下: <%@ LANGUAGE=VBSCRIPT %> The Application Object The ASP Application Object <% 'look for a command sent from the FORM section buttons If Len(Request.Form("cmdAdd")) Then ' 利用是否长度为0来判断 strVarName = Request.Form("txtVarName") strVarValue = Request.Form("txtVarValue") Application.Lock Application(strVarName) = strVarValue ' 此处报错 Application.Unlock End If If Len(Request.Form("cmdRemoveThis")) Then strToRemove = Request.Form("lstRemove") Application.Lock Application.Contents.Remove(strToRemove) Application.Unlock End If If Len(Request.Form("cmdRemoveAll")) Then Application.Lock Application.Contents.RemoveAll Application.Unlock End If %>
The Application.Contents Collection <% For Each objItem in Application.Contents If IsObject(Application.Contents(objItem)) Then Response.Write "Object reference: '" & objItem & "'" ElseIf IsArray(Application.Contents(objItem)) Then Response.Write "Array: '" & objItem & "' contents are:" varArray = Application.Contents(objItem) 'note: the following only works with a one-dimensional array For intLoop = 0 To UBound(varArray) Response.Write " Index(" & intLoop & ") = " & varArray(intLoop) & "" Next Else Response.Write "Variable: '" & objItem & "' = " _ & Application.Contents(objItem) & "" End If Next %>
The Application.StaticObjects Collection <% For Each objItem in Application.StaticObjects If IsObject(Application.StaticObjects(objItem)) Then Response.Write "