⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 5.htm

📁 IIS5.0超级管理手册-网页开发篇 书籍语言: 简体中文 书籍类型: 网页设计 授权方式: 免费软件 书籍大小: 262 KB
💻 HTM
📖 第 1 页 / 共 5 页
字号:
<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>5</title>
</head>

<body>

<p align="center"><font size="5" color="#0078FF">
<span style="font-weight: 700; background-color: #CCCCCC">5. ASP内建物件的参考</span></font></p>
<div language="javascript" id="tab1" style="line-height: 25px; margin-left: 20px" ondragover="return tab1_ondragover()">
  <font face="arial" color="#000000" size="2" style="line-height: 25px">Active 
  Server Pages(ASP)有一些使元件可以存取ASP内建物件的属性和方法的类别。譬如,<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;ObjectContext&nbsp;</b></font>使用了可以传回ASP内建物件介面的方法。元件可以使用这些介面来存取ASP内建物件的属性和方法。下表列出了内建物件的类别:</font><center style="line-height: 25px">
  <table border="1" style="line-height: 25px">
    <tbody style="line-height: 25px">
      <tr style="line-height: 25px">
        <th style="line-height: 25px"><font size="2" style="line-height: 25px">
        类别</font> </th>
        <th style="line-height: 25px"><font size="2" style="line-height: 25px">
        用途</font></th>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Application</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Application&nbsp;</b></font>物件的属性和方法。</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        ASPError</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;ASPError&nbsp;</b></font>物件的属性和方法。</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        ObjectContext</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        传回内建物件并提供在交易处理中所使用的方法。</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Request</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Request&nbsp;</b></font>物件的属性和方法。</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Response</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Response&nbsp;</b></font>物件的属性和方法。</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        ScriptingContext</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        传回内建物件:<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Application、Request、Response、Server&nbsp;</b></font>或<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Session&nbsp;</b></font>。这是个过时的方法,应当使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;ObjectContext&nbsp;</b></font>代替它。</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Server</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Server&nbsp;</b></font>物件的属性和方法。</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        Session</font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Session&nbsp;</b></font>物件的属性和方法。</font></td>
      </tr>
  </table>
  </center>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  如果您要使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;ObjectContext&nbsp;</b></font>和Visual 
  Basic元件中的内建物件,必须在Visual Basic专案中使用MicrosoftASP Object Library。</font></p>
  <a name="205001" style="line-height: 25px">
  <p><font face="arial" color="#3e70d7" size="5" style="line-height: 25px">
  <b style="line-height: 25px">Application物件<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  您可以在某个应用程式中使用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Application&nbsp;</b></font>物件,让所有的使用者可以共用资讯。一个以ASP为基础的应用程式被定义为一个虚拟目录和其子目录中的所有 
  .asp档案。因为<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Application&nbsp;</b></font>物件可以被不止一个使用者使用,所以应用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;lock&nbsp;</b></font>和<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Unlock&nbsp;</b></font>方法来保证多个使用者不会同时改变某个属性。</font></p>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">语法<br style="line-height: 25px">
 </b></font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">Application.method</pre>
    </font>
  </div>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">集合<br style="line-height: 25px">
 </b></font></p>
  <center style="line-height: 25px">
  <table border="1" style="line-height: 25px">
    <tbody style="line-height: 25px">
      <tr style="line-height: 25px">
        <td style="line-height: 25px">
        <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
        <b style="line-height: 25px">&nbsp;Contents&nbsp;</b></font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        包含所有透过指令档加到应用程式中的项目</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px">
        <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
        <b style="line-height: 25px">&nbsp;StaticObjects&nbsp;</b></font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        包含用&lt;OBJECT&gt;标记加到程式范围中的所有物件</font></td>
      </tr>
  </table>
  </center>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">方法<br style="line-height: 25px">
 </b></font></p>
  <center style="line-height: 25px">
  <table border="1" style="line-height: 25px">
    <tbody style="line-height: 25px">
      <tr style="line-height: 25px">
        <td style="line-height: 25px">
        <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
        <b style="line-height: 25px">&nbsp;Contents.Remove&nbsp;</b></font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
        <b style="line-height: 25px">&nbsp;Contents.Remove&nbsp;</b></font>方法是从Contents集合的某个Application物件中删除一个项目。</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px">
        <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
        <b style="line-height: 25px">&nbsp;Contents.RemoveAll&nbsp;</b></font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
        <b style="line-height: 25px">&nbsp;Contents.RemoveAll&nbsp;</b></font>方法从Contents集合的某个Application物件中删除所有项目。</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px">
        <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
        <b style="line-height: 25px">&nbsp;lock&nbsp;</b></font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
        <b style="line-height: 25px">&nbsp;lock&nbsp;</b></font>方法阻止其它的用户端更改 
        Application物件的属性。</font></td>
      </tr>
      <tr style="line-height: 25px">
        <td style="line-height: 25px">
        <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
        <b style="line-height: 25px">&nbsp;Unlock&nbsp;</b></font></td>
        <td style="line-height: 25px"><font size="2" style="line-height: 25px">
        <font face="arial" color="#3e80d7" size="2" style="line-height: 25px">
        <b style="line-height: 25px">&nbsp;Unlock&nbsp;</b></font>方法能让其它的用户端更改 
        Application物件的属性。</font></td>
      </tr>
  </table>
  </center>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">事件<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  Application_ OnEnd</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  Application_ OnStart</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  上述事件的指令档在是在Global.asa档案中宣告的。关於这些事件和Global.asa档案的更多资讯,请参考&nbsp;</font></a><font face="arial" color="#000000" size="2" style="line-height: 25px"><a target="_new" href="http://e-msbooks.com/relaunch/XML/paser.asp?src=957-2085-16-6_207.xml#207004" style="line-height: 25px">第7章〈指令码参考〉中的〈Global.asa 
  Reference〉</a>&nbsp;。</font></p>
  <p><font face="arial" color="#3e76d7" size="2" style="line-height: 25px">
  <b style="line-height: 25px">注解<br style="line-height: 25px">
 </b></font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  您可以在Application集合中储存变数值。储存在这个位置的资讯在整个应用程式范围之内都是有效的。下面的指令档说明了两种变数的储存方法。</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">&lt;%
   Application (&quot;Greeting&quot;) = &quot;Welcome to My Web World!&quot;
   Application ( &quot;Num&quot;) = 25
%&gt;</pre>
    </font>
  </div>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  这些变数都是<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Application 
  Contents&nbsp;</b></font>集合中的一个元素。您可以指定元件例项给一个全域变数。如果用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Server.CreateObject&nbsp;</b></font>方法指定全域变数的值,那麽这个变数就是Application 
  Contents集合中的元素。如果使用 &lt;OBJECT&gt; 标记指定变数,那麽该变数就是Application StaticObjects集合中的元素。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  指定应用程式全域变数的值时要小心,因为有些元件并没有设计成全域的。若需更多的资讯,请参阅Platform SDK。</font></p>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">如果您在<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Application 
  Contents&nbsp;</b></font>集合中指定一个变数值,而且使用Visual BasicScripting Edition(VBScript)作为主要的描述语言,那麽必须用<font face="arial" color="#3e80d7" size="2" style="line-height: 25px"><b style="line-height: 25px">&nbsp;Set&nbsp;</b></font>关键字。下面的指令档说明了这种情况:</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">
    <pre style="line-height: 25px">&lt;% Set Application ( Obj1 ) = Server.CreateObject(&quot;MyComponent&quot;) % &gt;</pre>
    </font>
  </div>
  <p><font face="arial" color="#000000" size="2" style="line-height: 25px">
  您可以利用以下的指令档来使用网页上的MyComponent的方法和属性:</font></p>
  <div style="line-height: 25px; background-color: #d7d7d7">
    <font face="Arial" size="3" style="line-height: 25px">

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -