|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
缺点:正版成本价格贵(盗版就不说了)、不够安全,大多数服务器用windows系统,没有linux安全 有如许一个法式,是对Application纠合中的元素停止举动的添加与删除,法式以下:
<%@ LANGUAGE=VBSCRIPT %>
<HTML>
<HEAD>
<TITLE>The Application Object</TITLE>
<STYLE TYPE="text/CSS">
BODY {font-family:Tahoma,Arial,sans-serif; font-size:10pt}
INPUT {font-family:Tahoma,Arial,sans-serif; font-size:9pt}
.heading {font-family:Tahoma,Arial,sans-serif; font-size:14pt; font-weight:bold}
.subhead {font-family:Tahoma,Arial,sans-serif; font-size:12pt; font-weight:bold; padding-bottom:5px}
.cite {font-family:Tahoma,Arial,sans-serif; font-size:8pt}
</STYLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<SPAN CLASS="heading">The ASP Application Object</SPAN><HR>
<!--------------------------------------------------------------------------->
<% '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
%>
<P><DIV CLASS="subhead">The Application.Contents Collection</DIV>
<%
For Each objItem in Application.Contents
If IsObject(Application.Contents(objItem)) Then
Response.Write "Object reference: '" & objItem & "'<BR>"
ElseIf IsArray(Application.Contents(objItem)) Then
Response.Write "Array: '" & objItem & "' contents are:<BR>"
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) & "<BR>"
Next
Else
Response.Write "Variable: '" & objItem & "' = " _
& Application.Contents(objItem) & "<BR>"
End If
Next
%>
<P><DIV CLASS="subhead">The Application.StaticObjects Collection</DIV>
<%
For Each objItem in Application.StaticObjects
If IsObject(Application.StaticObjects(objItem)) Then
Response.Write "<OBJECT> element: ID='" & objItem & "'<BR>"
End if
Next
%>
<!-- collect values to execute Application methods with -->
<FORM ACTION="<% = Request.ServerVariables("SCRIPT_NAME") %>" METHOD="POST"> ' 使用Request.ServerVariables("SCRIPT_NAME")将表单提交给本身
<P><DIV CLASS="subhead">Add a value to the Application Object</DIV>
<INPUT TYPE="SUBMIT" NAME="cmdAdd" VALUE=" ">
Application("
<INPUT TYPE="TEXT" NAME="txtVarName" SIZE="15" VALUE="My_New_Value">
") = "
<INPUT TYPE="TEXT" NAME="txtVarValue" SIZE="20" VALUE="Testing, testing ...">
"<P>
<P><DIV CLASS="subhead">Remove a value from the Application Object</DIV>
<INPUT TYPE="SUBMIT" NAME="cmdRemoveThis" VALUE=" ">
Application.Contents.Remove("
<SELECT NAME="lstRemove" SIZE="1">
<%
For Each objItem in Application.Contents
Response.Write "<OPTION>" & objItem & "</OPTION>"
Next
%>
</SELECT>")<BR>
<INPUT TYPE="SUBMIT" NAME="cmdRemoveAll" VALUE=" ">
Application.Contents.RemoveAll
</FORM>
<P><DIV CLASS="subhead">Other Application Methods</DIV>
Application.Lock<BR>
Application.Unlock<P>
<!--------------------------------------------------------------------------->
<HR><SPAN CLASS="cite"> |
|