<html>
<head>
<title>Application IuWFNg</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div id="">
<table cellpadding="0" cellspacing="0" border="0" width="100%" class="main">
<tr>
<td valign="top" class="NAME">Application IuWFNg</td>
<td valign="top" class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td valign="top" colspan="2" class="description">
<p><!--<primary>Application
object</primary>-->ASP (Active Server Pages : ANeBuT[o[y[W) ̃ReLXgł́AAvP[V́Aw肳ꂽzfBNgт̃TufBNgoRăANZXł邷ׂẴt@C̍vłB<em></em> ASP AvP[VReLXǵAAvP[VgpĂ邷ׂẴNCAgɑ΂ēłBƂ΁A"<filename>/SearchApp</filename>" zfBNg̃y[Wv^CݏZ̃NCAǵAzfBNg̃y[WvĂʂ̃XEF[fݏZ̃NCAgƓ "AvP[V" ɃANZX邱ƂɂȂ܂B́AeNCAgv鉼zfBNg̓ Web y[Wɂ͖֌WłB</p>




<p>]̃X^hAAvP[VƓlAASP AvP[VAvP[VŜŏLł܂B<em>Application</em> IuWFNggpĂAw肵 ASP AvP[Vׂ̂ẴNCAgԂŏL邱Ƃł܂B̑gݍ݃IuWFNǵAASP AvP[V̂\AAvP[VɃANZXĂNCAg̐^CvÃNCAgvĂAvP[V̕Ɋ֌WȂ̂̂łB</p>




<p>Application IuWFNǵAŏ̃NCAgw肳ꂽzfBNg̔Cӂ̃t@CvƂɁAIIS ɂď܂B<em></em> Application IuWFNǵAWeb T[rX~邩AMicrosoft ǗR\[ (Microsoft Management Console) gpăAvP[V Web T[o[疾IɃA[h܂ŁAT[o[̃Ɏc܂B</p>




<p>IIS ł́AAvP[Vx̃XR[vgpĕϐƃIuWFNgCX^Xł܂B܂Aw肳ꂽϐ́AAvP[Vׂ̂ẴNCAgɑ΂ēlێ܂B܂AׂẴNCAgɑ΂ēlێT[o[̃IuWFNgAAvP[Vx̃XR[vgpăCX^Xł܂B̃AvP[Vx̕ϐƃIuWFNgɂ́ACӂ̃[U[ZbṼReLXgƌ݂̃AvP[V̔Cӂ̃t@CANZXĕύXł܂B</p>




<p>Oq̂ƂAApplication IuWFNg
<!--<primary>initializing</primary><secondary>Application
object</secondary>-->́AAvP[V̍ŏ̃[U[ ASP AvP[VɊ܂܂鉼zfBNg̃t@CvƂɔ܂B̏́Aw肳ꂽ ASP AvP[Vpɗ\񂳂ꂽƍl܂BWeb T[o[́AApplication IuWFNgCX^X܂BA"<filename>GLOBAL.ASA</filename>" ƌĂ΂ʂȃIvVt@CɃR[hLq邱ƂɂȀJX^}CYł܂B<!--<primary>global variables</primary>-->
<!--<primary>application-level
scope</primary>--> <!--<primary>GLOBAL.ASA file</primary>-->
<!--<primary>scope</primary><secondary>application-level</secondary>-->
<!--<primary>variables</primary><secondary>scope</secondary><see>scope</see>-->
<!--<primary>objects</primary><secondary>scope</secondary><see>scope</see>-->̃t@C̏ڍׂɂĂ<link linkend="ch11-1-fm2xml"> 11 </link>Ő܂Ał͊TȒPɐ܂B</p>




<p>"<filename>GLOBAL.ASA</filename>" t@Ĉ݂́Aꂪ ASP AvP[V̉zfBNgɂă}bvꂽfBNg̃[gɂꍇłB̃t@ĆAVK̃[U[AvP[V̉zfBNg̃y[Wv邽тɏ܂B̃t@Cɂ́A[U[ZbVƃAvP[V̗̂̏R[h܂܂Ă܂B[U[߂Ẵ[U[łȂꍇA"<filename>GLOBAL.ASA</filename>" ̃AvP[VŗL̃ZNV͏܂B"<filename>GLOBAL.ASA</filename>" t@C݂Ȃ̃t@CɃR[h܂܂ꂸA[U[̗vw肳ꂽAvP[Ṽt@Cɑ΂ Web T[o[̍ŏ̗vłꍇAWeb T[o[ Application IuWFNg܂BAWeb T[o[̏ɂ̓AvP[VɕKvȃ̃TCŶ݂֌W܂B</p>




<p>"<filename>GLOBAL.ASA</filename>" t@Cɂ́AAvP[Vx̃XR[vϐƃIuWFNg쐬ꏊpӂĂ܂B"<filename>GLOBAL.ASA</filename>" t@Ĉ̃ZNV́ACxgvV[W\܂B̃Cxg OnStart CxgłÃCxgnh̓AvP[VNƎs܂B"<filename>GLOBAL.ASA</filename>" t@C͗v邷ׂẴ[U[ɑ΂ď܂AApplication IuWFNg OnStart Cxg͍ŏ̃[U[݂̂ɑ΂Ďs邱ƂɒӂĂBOnStart CxgvV[WƁAΉ OnEnd CxgvV[W̏ڍׂɂẮA{͂̌̕Ő܂B</p>




<p>AvP[Vx̃XR[vgpϐƃIuWFNǵAAvP[V̌pԒAׂẴ[U[ɑ΂ēlƂȂ܂B1 l̃[U[AAvP[Vx̕ϐ̒lύXR[h܂ރy[WvƁA̕ϐ̒lׂ͂Ẵ[U[ɑ΂ĕύX܂BɂÂ悤Ȗ肪܂B܂Ã[U[AɓAvP[Vxϐ̕ύX݂\܂BKȀ󋵂ɂ鋣̖邽߂ɁAASP ł Application IuWFNg Lock \bh Unlock \bh𗘗pł܂B}`XbhAvP[VɊ܂܂O[oϐ̎gpɊւlKv̂ƓlɁAAvP[Vx̃XR[vgpϐ̎gpɊւɂĂlKv܂BAvP[Vx̕ϐ̎gpɂ͒ӂKvłB</p>




<p>ASP Application IuWFNg̃vpeBARNVA\bhAуCxg̊TɂẮAu<link linkend="ch04-59578">Application IuWFNg̊Tv</link>vQƂĂB</p>




<!--
<p class="TITLE">Application Object Summary</p>




<dl>
<dt>Properties</dt>
<dd><p>None</p></dd>







<dt>Collections</dt>
<dd><p>Contents</p>






<p>StaticObjects</p>
</dd>




<dt>Methods</dt>
<dd><p>Contents.Remove</p>




<p>Contents.RemoveAll</p>




<p>Lock</p>




<p>Unlock</p>
</dd>




<dt>Events</dt>
<dd><p>OnEnd</p>




<p>OnStart</p>

</dd>

</dl>

-->

</td></tr>
</table>
</div>
<div id="CommentsTroubleshooting">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
RgуguV[eBO</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2">&nbsp;</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">

<p><!--<primary>comments and
troubleshooting</primary><secondary>global
variables</secondary>-->AvP[Vx̕ϐƂ́Aۏ ASP AvP[ṼO[oϐ̂ƂłBASP AvP[VɂO[oϐ̎gpɂẮA]̃X^hAAvP[VɂO[oϐ̎gpƓ炢A܂͂ȏɐTdɍlKv܂BłdvȃXebv́AAvP[Vx̃XR[vgpIuWFNg܂͕ϐOɁÃXR[vTdɌ邱ƂłB ASP O[oϐ̎gpKvȗ͂قƂǂ܂B</p>

<p>̂悤ȒӂƂ͕ʂɁAAvP[Vx̕ϐ܂̓IuWFNg̎gpA@\I ASP AvP[V쐬ۂɖ𗧂̗Ⴊ܂Błdvȗ 1 ƂāAWeb TCgɂăAvP[VŗL̓vǗ邱Ƃ܂BƂ΁A[U[ZbVJn邽тɑAvP[Vx̕ϐgpāAAvP[Vgp̃NCAg̐Ǘ邱Ƃł܂BMicrosoft Site Server Ȃǂ Web Ǘc[l̃^XNs܂A̓v̓AvP[VŗLł͂Ȃt@CŗL̂̂łB</p>




<p>ꕔ ASP ł́AAvP[Vx̃IuWFNggpāAׂẴAvP[V[U[ɑ΂ĊJꂽ <!--<primary>ADO (ActiveX Data
Objects)</primary><secondary>application-level objects to maintain
connections</secondary>--> <!--<primary>ActiveX Data
Objects</primary><see>ADO</see>-->ActiveX Data Objects (ADO) f[^x[XڑǗ邱Ƃ𐄏Ă܂BADO ̏ڍׂɂẮA<link linkend="ch12-1-fm2xml"> 12 </link>QƂĂB́AAvP[Vx̕ϐ̎gp@ƂĂ͐܂B̕@ɂAODBC (Open Database Connectivity) ̓y[WƂɐڑv[邱ƂłȂȂ邩łB<em></em>AAvP[Vx̕ϐgpƁAf[^x[Xڑɑ΂AvP[VŗL̐ڑǗł܂B
</p>


<p>ODBC ڑv[ɂ́AA郆[U[ ODBC ڑėpł郁\bhpӂĂ܂BT[o[ł́ANCAgv邽тɐVڑ쐬ɁAɑ݂ĂĖgpɂȂڑ̍ėp݂܂Bgp ODBC ڑ MMC ō\ꂽԂ̌oߌɃɂꍇ́A̐ڑ͍폜ăJ܂B</p>

<p>AvP[Vx̕ϐуIuWFNg̎gpꍇAӂȂ΂ȂȂ肪 1 ܂BɎ܂B"<filename>c:\inetpub\wwwroot\MainApp</filename>"  "<filename>c:\inetpub\wwwroot\MainApp\SearchApp</filename>"  2 ̕fBNgƂ܂B̃fBNǵAzfBNg "<filename>/MainApp</filename>"  "<filename>/SearchApp</filename>" ɂꂼ}bv܂BۏAAvP[VɃAvP[V邱ƂɂȂ܂Bŏ̃NCAgA"<filename>c:\inetpub\wwwroot\MainApp\SearchApp</filename>" fBNg̃y[Wv܂BApplication IuWFNg邽߂ɁA"<filename>/MainApp</filename>"  "<filename>GLOBAL.ASA</filename>" ܂ "<filename>/SearchApp</filename>"  "<filename>GLOBAL.ASA</filename>" ̂̏R[hgpł傤B̏ꍇA"<filename>/SearchApp</filename>"  "<filename>GLOBAL.ASA</filename>" ܂B"<filename>/SearchApp</filename>" ɑ݂Ȃ "<filename>/MainApp</filename> " ̃t@Cv܂ŁA"<filename>/MainApp</filename>"  "<filename>GLOBAL.ASA</filename>" t@C͏܂B2  "<filename>GLOBAL.ASA</filename>" t@CňقȂÃAvP[Vxϐ`ꍇAeXgȂ Application ϐK؂ɏꂽƂR[hŒm@͂܂B</p>




<p>ŌɁA IIS ł́AMicrosoft ǗR\[ (Microsoft Management Console) ̓̉zfBNg̃vpeBplŃIvVw肷邾ŁA݂ɈقȂ郁Xy[XA܂ Web T[o[̂Ƃ͕ʂ̃Xy[X ASP AvP[Vݒł܂B̋@\ IIS ̏dvȉǓ_łBASP AvP[V Web T[o[Ƃ͕ʂ̃Xy[XŎsA̒Ɋ܂܂T[o[IuWFNg (܂̓XNvgGW) NbVꍇAWeb T[o[܂͑ ASP AvP[V̓NbV܂B<filename/>   </p>
</td>
</tr>
</table>
</div>
<div id="ContentsCollection">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Contents RNV</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="PROGRAMLISTING"><pre>Application.Contents.Item("Pi") = 3.14</pre></span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p><!--<primary>Contents
collection</primary><secondary>Application
object</secondary>--> <!--<primary>Application
object</primary><secondary>collections
reference</secondary>-->Application IuWFNg Contents RNVɂ́A<em></em><span class="LITERAL">&lt;OBJECT&gt;</span> ^O̎gpɂĂł͂ȂAXNvg̎gpɂČ݂̃AvP[Vɒǉ邷ׂẴAvP[Vx̃XR[v̕ϐƃIuWFNg܂܂܂B</p>




<p>Contents RNVɗvfǉ@mFOɁA܂ Contents RNṼvpeB𗝉Kv܂BContents RNVɂ͈ȉɎ 3 ̃vpeB܂B</p>




<dl>
<dt>Item</dt>
<dd><p><!--<primary>Item property</primary><secondary>Contents
collection</secondary>-->Contents RNV̓̃o[̒l擾܂BL[gp郁o[ (Key vpeBɂCfbNXgpĒlł郁o[Aڍׂ͖{̌̕Ő)A܂̓CfbNXԍgp郁o[w肵܂BƂ΁AContents RNVɊ܂܂vf Pi ̒lgpďꍇÂ悤ȈÃR[hgpł܂B</p>




<span class="PROGRAMLISTING"><pre>Application.Contents.Item("Pi") = 3.14</pre></span>




<p>ÕR[hsł́ARNVɊ܂܂ړI̗vf́AL[l "Pi" gpĎw肵܂B̂悤ɏƁÃR[hsgpāAContents RNV̗̂vf̒l擾ł܂B</p>




<span class="PROGRAMLISTING"><pre>dblMyVar = Application.Contents.Item("Pi")</pre></span>




<p>ɖ炩ɂȂ邱ƂłAꂪ Contents RNVɒǉŏ̗vfłƂ܂B</p>




<p>̃R[hs悤ɁAL[ł͂ȂARNVɊ܂܂CfbNXgpĂAContents RNVɊ܂܂vf̒l擾ł܂B</p>




<span class="PROGRAMLISTING"><pre>dblMyVar = Application.Contents.Item(1)</pre></span>




<p>Contents RNVɊ܂܂ŏ̗vf\ɂ́A0 ł͂Ȃ 1 gp܂B̃R[hs 0 gpƁAϐ dblMyVar `̒lŏ邽߁A͔ȃ|CgłBcOȂAɂG[͔܂BʂƂāAϐsK؂ɏ邾łB</p>




<span class="PROGRAMLISTING"><pre>dblMyVar = Application.Contents.Item(0) ' WRONG.</pre></span>




<p>Item  Contents RNṼftHg̃vpeBłAContents RNV Application IuWFNg̃ftHg̃RNVłB܂A 3 s̃R[h́AAvP[Vł܂@ŉ߂܂B</p>




<span class="PROGRAMLISTING"><pre>Application.Contents.Item("Pi") = 3.14
Application.Contents("Pi") = 3.14
Application("Pi") = 3.14</pre></span>




<p>lɁA 3 ̃R[hs܂łƑzł܂B</p>




<span class="PROGRAMLISTING"><pre>Application.Contents.Item(1) = 3.14159
Application.Contents(1) = 3.14159
Application(1) = 3.14159</pre></span>




<p>A Contents RNVɊ܂܂ŏ̗vfL[gpĒ`ĂꍇłBASP ɓYtꂽ}jAɂ͋LڂĂ܂񂪁AOq̍ŏ 2 ̃R[hŝꂩgpɂ́AL[gpĂ̗vf炩ߒ`ĂKv܂BƂ΁AContents RNV 2 Ԗڂ̗vfǉƂ܂B̂ꂩ̃R[hsgpāA̗vf邱Ƃ͂ł܂B</p>




<span class="PROGRAMLISTING"><pre>Application.Contents.Item(2) = 3.14159     ' WRONG.
Application.Contents(2) = 3.14159          ' WRONG.</pre></span>




<p>cOȂA̗OɂO܂B̃R[hgpƁA2 Ԗڂ̕ϐł܂B<em></em></p>




<span class="PROGRAMLISTING"><pre>Application(2) = 3.14159</pre></span>




<p>̖lꍇAContents RNVɊ܂܂̗vf̒lQƂۂɏɈԈSȕ@́ACfbNXł͂ȂL[gp邱Ƃł邱Ƃɂ킩܂B</p>




<p>܂Ao[̃CfbNX͕ύX\邽߁AContents RNV̓̃o[QƂƂL[gp邱ƂdvłBƂ΁AAvP[VɎ̃R[hƂ܂B</p>




<span class="PROGRAMLISTING"><pre>Application("strFirstName") = "Arthur"
Application("strMiddleName") = "Keyton"
Application("strLastName") = "Weissinger"</pre></span>




<p>̕ϐ Contents RNVɒǉꂽŏ 3 ̕ϐłƂƁAł̃CfbNXgpĂꂼQƂł܂B</p>




<span class="PROGRAMLISTING"><pre>strFirst = Application(1) 
strMiddle = Application(2)
strLast = Application(3)</pre></span>




<p>ARNVϐSɍ폜 Remove \bh ({͂̌̕Q) gp strMiddleName ϐ폜ꍇACfbNXԍύX܂B</p>




<span class="PROGRAMLISTING"><pre>Session.Contents.Remove("strMiddleName")

strFirst = Application(1)          ' Initializes to "Arthur" 
strMiddle = Application(2)         ' Initializes to "Weissinger"
strLast = Application(3)           ' Initializes to Undefined.</pre></span></dd>




<dt>Key</dt>
<dd><p><!--<primary>Key property</primary><secondary>Contents
collection</secondary>-->Contents RNV̗̓vf̖O\܂Bevf̒l Item vpeBŕ\ƂƂvoĂBlɁAevf̖ÓAKey vpeBɂĕ\܂B</p>




<p>̃L[̖Osȏꍇ́AQƂgpĎ擾ł܂BƂ΁ARNVɊ܂܂ 3 Ԗڂ̗vf̃L[擾ĂA̗vf̒l擾Ƃ܂B̏ꍇ́ÃR[hgpł܂B</p>




<span class="PROGRAMLISTING"><pre>strKeyName = Application.Contents.Key(3)
strKeyValue = Application.Contents.Item(strKeyName)</pre></span></dd>




<dt>Count</dt>
<dd><p><!--<primary>Count property</primary><secondary>Contents
collection (Application)</secondary>-->Contents RNVɊ܂܂vf̍v\܂B</p></dd>

</dl>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<p>
<!--<primary>initializing</primary><secondary>application-level
variables</secondary>-->AvP[Vx̕ϐł̂ŁA2 ̕@̂ꂩɂAContents RNVɗvfǉł܂B܂A<link linkend="ch04-21135"> 4.1</link> Ŏ悤ɁA"<filename>GLOBAL.ASA</filename>" t@C Application_OnStart CxgvV[WɊ܂܂ Application ϐł܂B</p>




<example id="ch04-21135" label="4.1">
<p class="TITLE">"GLOBAL.ASA" Ɋ܂܂AvP[Vx̕ϐ̏ </p>



<span class="PROGRAMLISTING"><pre>' &lt; FROM GLOBAL.ASA &gt;
' This code resides in the GLOBAL.ASA file at the
' root of the current application.
' See <link linkend="ch11-1-fm2xml">Chapter 11</link> for more details on the GLOBAL.ASA file.

Sub Application_OnStart

   Application.Contents.Item("STATE_FIRST") = "California"
   Application.Contents("STATE_SECOND") = "Oregon"
   Application("STATE_THIRD") = "Washington"

End Sub</pre></span>

</example>




<p><link linkend="ch04-21135"> 4.1</link> ̃R[h́A3 ̃AvP[VXR[v̕ϐ쐬AContents RNV 3 ̗vfǉ܂B̕ϐCX^Xď̂́A㑱̃[U[TCg{邽тɂł͂ȂAAvP[V̊JnłB̕ϐ́AׂẴy[WƂׂẴ[U[ɂĕʂ̃XNvgɂĕύXȂ蓯lێ܂B</p>




<p>Oq̃R[h́AL[gp Contents RNVɗvfǉ܂B܂Aȉ̂悤ɁACfbNXlgpăRNVɗvfǉ邱Ƃł܂B</p>




<span class="PROGRAMLISTING"><pre>Application.Contents(1) = "California"</pre></span>




<p>ARNVɗvfǉƂ́AL[܂̓CfbNX̂ꂩgp܂Bgp邱Ƃ͂ł܂BCfbNXƃL[̗ŗvfǉꍇAL[gpvfɂAL[蓖ĂĂȂʂ̗vf㏑܂B</p>




<p>܂AAvP[VXR[v̕ϐł邽߁ACӂ̃y[W̃XNvg Contents RNVɗvfǉł܂BA̕@ō쐬ϐ́AAvP[VŜƃ[U[ׂĂɑ΂č쐬ĕێ܂B<link linkend="ch04-28500"> 4.2</link> ɁAAvP[VXR[v̕ϐ郁\bh܂B</p>




<example id="ch04-28500" label="4.2">
<p class="TITLE">T[o[̃XNvgɊ܂܂AvP[Vx̕ϐ̏ </p>



<span class="PROGRAMLISTING"><pre>&lt;%
' This code exists in the server-side section of a script
' on the web site.
Application.Contents.Item("STATE_FOURTH") = "New York"
Application.Contents("STATE_FIFTH") = "New Jersey"
Application("STATE_SIXTH") = "Vermont"

%&gt;</pre></span>
</example>




<p><link linkend="ch04-28500"> 4.2</link> ɎR[h́A 3 ̃AvP[VXR[vϐAvP[Vɒǉ܂B̕ϐ́A[U[̃R[h܂ރy[Wv邽тɍď܂BvZbT\̘͂Qhɂ́Â悤ȃR[hgpĂ̏s邱Ƃ߂܂B</p>




<span class="PROGRAMLISTING"><pre>&lt;%
' A more efficient example of the creation of an 
' application-scoped variable.
If IsEmpty(Application.Contents.Item(STATE_SEVENTH)) Then
   Application.Contents(STATE_SEVENTH) = "Texas"
End If

%&gt;</pre></span>




<p>̃R[h́Ã݂AvP[V 7 Ԗڂ̃AvP[VϐAɍ쐬ĂȂꍇɂ̂ݍ쐬܂B</p>




<p><!--<primary>For Each construct</primary><secondary>iterating
Contents collection</secondary>-->
<!--<primary>For...Next
construct</primary><secondary>iterating Contents
collection</secondary>-->Contents RNV́ARNVJԂgp邽߂ɁA<span class="LITERAL">For</span> <span class="LITERAL">Each</span>  <span class="LITERAL">For...Next</span> \vfT|[gĂ܂B̗<link linkend="ch04-23278"> 4.3</link> Ɏ܂B</p>




<example id="ch04-23278" label="4.3">
<p class="TITLE">Contents RNVł For Each ̎gp </p>



<span class="PROGRAMLISTING"><pre><strong class="userinput">&lt;%
For Each strKey in Application.Contents
%&gt;</strong>
   The next item in Application's Contents collection&lt;BR&gt;
   has &lt;%= <strong class="userinput">strKey</strong> %&gt; as its key and
   <strong class="userinput">&lt;%= Application.Contents(strKey) %&gt;</strong>
   as its value.&lt;P&gt;
<strong class="userinput">&lt;%
Next %&gt;</strong></pre></span>
</example>




<p>ÃRNVIuWFNgƂ͈قȂAContents RNVł <!--<primary>Add
method</primary><secondary>Contents collection
and</secondary>--> <!--<primary>Remove
method</primary><secondary>Contents
collection</secondary>-->Add \bh̓T|[gꂸAIIS 5.0 ܂ł Remove \bhT|[gĂ܂łBAvP[VXR[vœ肳ꂽϐ́AIɍ폜ȂAWeb T[o[~邩AŌ̃[U[ZbV^CAEg܂ŏ풓܂B</p>




<p>Application  Contents RNVɃIuWFNgǉꍇ́A<!--<primary>threading, application-level
scope and</primary>-->IuWFNg̃XbhfAvP[VXR[vł̎gpT|[gĂ邱ƂmFĂBt[Xbhf̎gp߂܂BIIS T[o[R|[lgł̊eXbhf̎gpɊւڍׂɂẮAO'Reilly Дs Shelley Powers w<citetitle>Developing ASP Components</citetitle>xQƂĂB&amp;<citetitle></citetitle>
</p>



<p>t[Xbhf̃AvP[VgpƁÃ[U[vZXR|[lg̓CX^XɓɃANZXł܂B</p>


<p>AvP[VXR[ṽIuWFNg̃vpeB܂̓\bhɃANZXɂ́A\̊g@\gp܂B̋@\ɂẮAɃAvP[VXR[v̕ϐlւ̃ANZX̍ŐĂ܂B̃R[hɎ܂B</p>




<span class="PROGRAMLISTING"><pre>' In this example, assume you have an application-scoped Ad 
' Rotator variable called MyAdRot.

' Accessing a property:
intBorder = Application.Contents("MyAdRot").Border

' Executing a method:
Application.Contents("MyAdRot").GetAdvertisement("Sched.txt")</pre></span>




<warning id="ch04-5-fm2xml" role="ora">
<p>
<!--<primary>ObjectContext
object</primary><secondary>application-level scope
and</secondary>-->ObjectContext IuWFNggpĂgUNVœ̃IuWFNggpꍇÃIuWFNgɃAvP[V܂̓ZbṼXR[vw肵ȂłBgUNVŎgpIuWFNǵAgUNVIɍ폜̂ŁǍ̃IuWFNg̃vpeBQƂ⃁\bhĂяoŃG[܂B</p>



</warning>

<p><!--<primary>arrays, adding to Contents
collection</primary>-->Application IuWFNg Contents RNVɔzǉꍇ́AzŜ܂Ƃ߂Ēǉ܂Bz̗vfύXꍇAz̃Rs[擾AvfύXĂAContents RNVɔzŜēxǉ܂B<link linkend="ch04-34094"> 4.4</link> ̃R[hł̗܂B</p>




<example id="ch04-34094" label="4.4">
<p class="TITLE">Contents RNVɊ܂܂z̏ </p>



<span class="PROGRAMLISTING"><pre>&lt;%
' Create an array variable and add it to Contents collection.
ReDim arystrNames(3)

arystrNames(0) = "Chris"
arystrNames(1) = "Julie"
arystrNames(2) = "Vlad"
arystrNames(3) = "Kelly"

Application("arystrUserNames") = arystrNames

%&gt;

The second name in the User Names array is 
&lt;%= Application("arystrUserNames")(1) %&gt;
&lt;BR&gt;
&lt;%

' Change an element of the array being held in the
' Contents collection.
Dim arystrNamesLocal

arystrNamesLocal = Application("arystrUserNames")
arystrNamesLocal(1) = "Mark"

Application("arystrUserNames") = arystrNamesLocal
' The second name is now Mark.

%&gt;
Now, the second name in the User Names array is
&lt;%= Application("arystrUserNames")(1) %&gt;
&lt;BR&gt;</pre></span>
</example>



</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Remove">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Remove</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">Application.Contents.Remove(</span><var class="replaceable">Key|Index</var>)
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">

<p><!--<primary>Remove method</primary><secondary>Contents
collection</secondary>-->
<!--<primary>memory</primary><secondary>user
sessions</secondary><tertiary>releasing</tertiary>-->
<!--<primary>user sessions</primary><secondary>memory
for</secondary><tertiary>releasing</tertiary>-->Contents RNṼo[폜܂BIIS 5.0 ɒǉꂽ Remove \bhgpƁA Application  Contents RNV̓̕ϐ폜ł܂B̏ꍇÂׂĂ̕ϐ폜邱Ƃ͂܂B</p>


</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">p[^</td>
</tr>
<tr>
<td colspan="2" class="description">




<dl>
<dt>Key</dt>
<dd><p>폜 Contents RNV̓胁o[̖Ow肷镶ϐłB</p></dd>




<dt>Index</dt>
<dd><p>폜 Contents RNṼo[̃CfbNXw肷鐮ϐłB</p></dd>

</dl>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<p>̃XNvg Contents RNV 2 ̃o[폜܂B</p>




<span class="PROGRAMLISTING"><pre>&lt;%
' This script assumes you have set up two greeting salutations for all
' the members of your site based on time of day. You want to now 
' remove these from your site.
strAppMorningGreeting = Application("strAMGreet")
strAppEveningGreeting = Application("strPMGreet")

.
.
.
Application.Contents.Remove("strAMGreet")
Application.Contents.Remove("strPMGreet")
.
.
.
%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<p><!--<primary>Remove method</primary><secondary>Contents
collection</secondary>-->Remove \bh Contents RNVւ̏dvȒǉ@\łAʓIȃǗƃN[Abv\ɂ܂B
<!--<primary>memory</primary><secondary>user
sessions</secondary><tertiary>releasing</tertiary>-->
<!--<primary>user sessions</primary><secondary>memory
for</secondary><tertiary>releasing</tertiary>-->ɂA[U[ZbV𒆒fȂŁARNV̗vf̈ꕔ폜ł܂BContents RNV Item vpeBŊɐƂARemove \bhĂяoƂ́ACfbNXł͂ȂL[gp邱ƂɏdvłBvf̃CfbNX̓AvP[V̌pԒɕω\ACfbNX̒lgp Remove \bȟĂяóA\ʌʂɂȂ邱Ƃ܂B</p>




<p>Application  Contents RNV Remove \bhł́AIIS Web ǗC^[tFCXgp Web AvP[VŜA[hȂĂAContents RNṼo[폜ł܂BȑO IIS 5.0 ł͂̋@\\łȂ߁AAvP[VXR[v̕ϐ̊ǗłB</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="RemoveAll">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
RemoveAll</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">Application.Contents.RemoveAll</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p><!--<primary>RemoveAll, Contents
collection</primary>-->Contents RNV炷ׂẴo[폜܂BIIS 5.0 ɒǉꂽ RemoveAll \bhɂAAvP[V̂A[hȂĂAׂẴAvP[VXR[v̕ϐ폜ł܂B</p>


</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">p[^</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Ȃ</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<p>̃XNvg Contents RNVׂ̂Ẵo[폜܂B</p>




<span class="PROGRAMLISTING"><pre>&lt;%
' This script assumes you have set up two greeting salutations for all 
' the members of your site based on time of day. You want to now remove 
' these from your site.
strAppMorningGreeting = Application("strAMGreet")
strAppEveningGreeting = Application("strPMGreet")

.
.
.
Application.Contents.RemoveAll
.
.
.
%&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Remove \bhƓlARemoveAll \bh Contents RNVւ̏dvȒǉ@\łAʓIȃǗƃN[Abv\ɂ܂B̃\bhɂAAvP[V̂A[hȂĂAׂẴAvP[VXR[v̕ϐ폜ł܂B</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="StaticObjects">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
StaticObjects </td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="PROGRAMLISTING"><pre>&lt;OBJECT RUNAT=Server SCOPE=Application ID=AppInfo2 
        PROGID="MSWC.MyInfo"&gt;
&lt;/OBJECT&gt;</pre></span></td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p><!--<primary>StaticObjects
collection</primary><secondary>Application
object</secondary>-->StaticObjects RNVɂ́A
<!--<primary>application-level
scope</primary><secondary>objects added with</secondary>-->
<!--<primary sortas="OBJECT tags">tags</primary><secondary>application-level objects added
with</secondary>-->
<!--<primary>scope</primary><secondary>application-level</secondary>--><span class="LITERAL">&lt;OBJECT&gt;</span> ^OgpăAvP[VɒǉׂẴIuWFNg܂܂܂BStaticObjects RNV Item vpeB (ڍׂɂĂ͌q) gpƁARNVɊ܂܂̃IuWFNg̃vpeB擾ł܂B܂A<command role="literal">StaticObjects</command> RNV Item vpeBgpāARNVɊ܂܂wIuWFNg̓̃\bhɃANZX邱Ƃł܂B</p>




<p>̃RNVɃIuWFNgǉɂ́A"<filename>GLOBAL.ASA</filename> "t@C "<span class="LITERAL">&lt;OBJECT&gt;</span>" ^OgpKv܂B̗Ɏ܂B</p>




<span class="PROGRAMLISTING"><pre>&lt;OBJECT RUNAT=Server SCOPE=Application ID=AppInfo2 
        PROGID="MSWC.MyInfo"&gt;
&lt;/OBJECT&gt;</pre></span>




<p>ASP AvP[V̑̏ꏊł́ÃRNVɃIuWFNgǉł܂B</p>




<p>StaticObjects RNVɂ́A ASP RNVƓlÃvpeB܂܂Ă܂B</p>




<dl>
<dt>Item</dt>
<dd><p><!--<primary>Item property</primary><secondary>StaticObjects
collection</secondary><tertiary>Application
object</tertiary>-->RNVɊ܂܂̗vfւ̎QƂԂ܂BACew肷ɂ́ACfbNXԍ܂̓L[gp܂B</p></dd>




<dt>Key</dt>
<dd><p><!--<primary>Key property</primary><secondary>StaticObjects
collection</secondary><tertiary>Application
object</tertiary>-->RNVɊ܂܂̗vf̖OԂ܂BO <span class="LITERAL">&lt;OBJECT&gt;</span> ^O <span class="LITERAL">ID</span> Ŏw肵܂BƂ΁Â悤ȃRNVɊ܂܂ŏ̗vf̖O󂯎\܂B</p>




<span class="PROGRAMLISTING"><pre>objElement = Application.StaticObjects.Key(1)</pre></span>




<p>Key vpeB̒lgpāAvf̒l𖼑OŎ擾܂BƂ΁AStaticObjects RNVɊ܂܂ŏ̃IuWFNg̖O MyAdRotator łƂ܂B̏ꍇÃR[hsgpāÃIuWFNg Border vpeB̒lݒ܂͎擾ł܂B</p>




<span class="PROGRAMLISTING"><pre>strKey = Application.StaticObjects.Key(1)
Application.StaticObjects.Item(strKey).Border = 0</pre></span></dd>




<dt>Count</dt>
<dd><p><!--<primary>Count property</primary><secondary>StaticObjects
collection</secondary><tertiary>Application
object</tertiary>-->RNVɊ܂܂錻݂̗vf̐łB</p></dd>

</dl>




<tip id="ch04-16-fm2xml" role="ora">
<p>RNV Item vpeBAKey vpeBA Count vpeB̏ڍׂɂẮA{͂őOq́u<link linkend="ch04-28098">Contents RNV</link>vQƂĂB</p>



</tip>
</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>' &lt; FROM GLOBAL.ASA &gt;
' This code resides in the GLOBAL.ASA file at the root
' of the current application. The following &lt;OBJECT&gt;
' tag is processed only once for the current application.
' See <link linkend="ch11-1-fm2xml">Chapter 11</link> for more details on the GLOBAL.ASA file.

&lt;OBJECT RUNAT=Server 
SCOPE=Application
ID=AppInfo1 
PROGID="MSWC.MyInfo"&gt;
&lt;/OBJECT&gt;

' &lt;&gt;

&lt;%
' The following code initializes the AppInfo1 component.
' This initialization code can reside anywhere.
AppInfo1.PersonalName = "Gertrude Stein"
AppInfo1.PersonalAddress = "233 Main Street"

' The following code uses the StaticObjects collection 
' of the Application object to retrieve the value
' of the PersonalName property of AppInfo1. 
For Each objInfo In Application.StaticObjects
%&gt;
   The personal name is &lt;BR&gt;
   &lt;%= Application.StaticObjects(objInfo).PersonalName%&gt;&lt;P&gt;
&lt;%
Next
%&gt;

There are &lt;%= Application.StaticObjects.Count %&gt; items
in the Application's StaticObjects collection.</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<p>StaticObjects RNVł́A<span class="LITERAL">&lt;OBJECT&gt;</span> ^O̎gpɂAvP[Vx̃XR[vŃCX^XIuWFNgɃANZXł܂BIuWFNg̓T[o[gpăCX^XĂ܂B<!--<primary>CreateObject method
(Server)</primary><secondary>StaticObjects collection
and</secondary>--><!--<primary>StaticObjects
collection</primary><secondary>CreateObject method
and</secondary>-->CreateObject \bhɂ́ÃRNVăANZX邱Ƃ͂ł܂Bł̖@͂╡GłBJԂ[vs邽߂ɁAStaticObjects RNVɂ́AServer IuWFNg CreateObject \bhł͂ȂA<span class="LITERAL">&lt;OBJECT&gt;</span> ^OgpăCX^XT[o[<em></em> IuWFNg܂܂Ă܂B</p>




<p>Microsoft ɂ IIS 4.0 }jAɋLڂĂ StaticObjects ̗ł́ÃRNVɑ΂ă[vs΁AevpeBQƂłƂĂ܂B͌\܂B́A}jAł̓RNV̓IuWFNĝ̂\̂ł͂ȂAۂ̓IuWFNĝׂẴvpeB\ƂȂĂ邩łBStaticObjects RNVɊ܂܂IuWFNg̃vpeB܂̓\bhɃANZXꍇAO̗Ŏ悤ɁAKey ̗̂̊OɃhbgZqgpǍɃvpeB܂̓\bh̖OLqKv܂B</p>




<p>"<filename>GLOBAL.ASA</filename>" t@Cɍ쐬IuWFNǵÃIuWFNg̃vpeB܂̓\bhŏɌĂяo܂ŁAT[o[ł͎ۂɃCX^X܂BāAStaticObjects RNVgpẴIuWFNg̃vpeB܂̓\bhɃANZXł̂́AAvP[VɊ܂܂鑼̈ꕔ̃R[hɂT[o[ŃIuWFNgCX^XꂽɂȂ܂B</p>




<p>ObjectContext IuWFNggpāAgUNVŎgpIuWFNgɃAvP[V܂̓ZbVXR[vǉȂłBgUNVŎgpIuWFNg̓gUNVIɍ폜邽߁Ǎ̃IuWFNg̃vpeBQƂ⃁\bhĂяoŃG[܂B </p>



</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Lock">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Lock</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">Application.Lock</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p><!--<primary>Lock method
(Application)</primary>--> <!--<primary>Application
object</primary><secondary>methods reference</secondary>-->
<!--<primary>locking/unlocking, Application
object</primary>--> <!--<primary>unlocking, Application
object</primary>-->Lock \bh Application IuWFNgbNÃNCAg Contents RNVɊ܂܂Cӂ̕ϐ̒l (Unlock \bȟĂяoOɕύXϐłȂ) ύXȂ悤ɂ܂B<em></em>Ή Unlock \bhgp Application IuWFNgł̂ŁÃNCAg Contents RNV̕ϐ̒lĂѕύXł܂BUnlock \bhgpłȂꍇAIIS ł́A݂ ASP XNvg̏IA܂̓XNvg̃^CAEĝꂩŏ̎_ŁAϐ̃bNIɉ܂B



<p>ASP XNvg̃^CAEǵAMicrosoft ǗR\[ (Microsoft Management Console) gpĂ Web TCg Properties y[WŒł܂Bݒl 120 błB</p>
</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">p[^</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Ȃ</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>&lt;%
' This script exists on the second page of a 
' multipage ASP application, so that users may
' or may not visit it. The example shows how you could
' see how many visitors the page has had.
' Assume that TotalNumPage2 starts at 0.

' Lock the Application object.
Application.Lock

intNumVisits = Application.Contents("TotalNumPage2")
intNumVisits = intNumVisits + 1
Application.Contents("TotalNumPage2") = intNumVisits

' Explicitly unlock the Application object.
Application.Unlock

' NOTE: Using the PageCnt.DLL would be a more
' efficient manner of doing this.

%&gt;
&lt;HTML&gt;
&lt;HEAD&gt;&lt;TITLE&gt;Home Page&lt;/TITLE&gt;&lt;/HEAD&gt;
&lt;BODY BGCOLOR = #ffffcc&gt;
Welcome to our homepage. You are client number 
&lt;%= Application.Contents("TotalNumPage2")%&gt; to our site. Thank you for your patronage.
&lt;/BODY&gt;
&lt;/HTML&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Web T[o[ɐڑĂNCAǵAApplication Contents RNVɊ܂܂ϐ̒lύXXNvgĂяo\܂BāAContents RNVɊ܂܂ϐQƂ܂͕ύXƂ́A Lock \bh Unlock \bhgp邱Ƃ߂܂BɂANCAgϐ̒lĂƂɁAʂ̃NCAg̕ϐ̒lύX邱Ƃł܂B</p>




<p>IIS ł Application IuWFNg̃bNIɉ܂B̂߁AΉ Unlock ̌ĂяoȂł́ALock \bhւ̌Ăяogpēǂݎp̕ϐ쐬łȂƂɒӂĂB</p>




<p>Application_<!--<primary>OnStart
event</primary><secondary>Application
object</secondary><tertiary>locking/unlocking Application
object</tertiary>-->OnStart CxgvV[W Lock \bh Unlock \bhĂяoKv͂܂BApplication_OnStart Cxg̏ڍׂɂẮA{͂́uCxgt@XvQƂĂBApplication_OnStart CxǵAŏIIɏZbV̐ɖ֌WɁA1 񂾂܂Bŏ̃NCAg̗v݂̂ Application_OnStart Cxg𔭐܂BāÃNCAĝ݂ Application ϐ̒lύXł܂B܂AApplication_OnStart R[h܂ŁÃNCAg̗v͏܂B </p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="Unlock">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
Unlock</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">Application.Unlock</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p><!--<primary>Unlock method
(Application)</primary>-->Unlock \bh́ALock \bȟĂяoɂAvP[Vϐ̃bN܂BUnlock \bhĂяoƁÃNCAg Application Contents RNVɊ܂܂Ăϐ̒lēxύXł悤ɂȂ܂BLock \bhĂяoAΉ Unlock \bhw肵ȂꍇAIIS ł́A݂ ASP ̍ŌA܂́AXNvg̃^CAEĝꂩŏ̎_ŁAApplication Contents RNVɊ܂܂ĂϐIɉ܂B</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">p[^</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Ȃ</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Application.Lock ̗QƂĂB</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Application.Lock ̃QƂĂB </p>



</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="OnEnd">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
OnEnd</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">Application_OnEnd</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Application_<!--<primary>OnEnd
event</primary><secondary>Application object</secondary>-->
<!--<primary>Application
object</primary><secondary>OnStart and OnEnd
events</secondary>--> <!--<primary>events</primary><secondary>Application
object</secondary>-->OnEnd CxǵAMicrosoft ǗR\[gp ASP AvP[V̂ Web T[o[A[hƂA܂̓AvP[V炩̗R (Web T[o[ Web T[rX~Ȃ) ŊԈĒ~Ƃɔ܂BApplication_OnEnd CxǵA1 ̃AvP[Vɑ΂ 1 ̂݌Ăяo܂B̃CxgvV[W̃R[h "<filename>GLOBAL.ASA</filename>" t@CɕۑAt@CɊ܂܂Ă鑼ׂ̂ẴR[ȟɏ܂B́ACӂ̃AvP[VXR[v̕ϐ̌ɍ폜AApplication_OnEnd Cxg̃R[hɂ܂B</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">p[^</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Ȃ</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>' &lt; FROM GLOBAL.ASA &gt;
' This code resides in the GLOBAL.ASA file at the
' root of the current application. The following
' procedure is processed only once for the current
' application.
' See <link linkend="ch11-1-fm2xml">Chapter 11</link> for more details on the GLOBAL.ASA file.

&lt;SCRIPT LANGUAGE="VBScript" RUNAT=Server&gt; 
Sub Application_OnEnd

' This code will run on the server when
' the application stops.
' This code saves the final count of an application
' use counter to a file.
Set filsysObj1 = _
    CreateObject("Scripting.FileSystemObject")
Set tsObj1 = filsysObj1.CreateTextFile("c:\usrcount.txt", _
             True)
tsObj1.WriteLine(Application.Contents("AppUserCount"))
tsObj1.Close

End Sub 
&lt;/SCRIPT&gt; 

' &lt;&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Application_OnEnd Cxg̎gpɂ͒ӂKvłBMicrosoft ̃}jAł́AANeBuȃZbVȂȂꍇ OnEnd CxgƂĂ܂BA̗͂ɂ͊Y܂BWeb T[rXfƂA܂́AǗ҂ Web T[o[̃ MMC gpăAvP[V𖾎IɃA[hƂɂ̂݁AOnEnd s܂B̕sɁA܂̓[U[̒ډȂŁAAvP[V炱̃CxgĂяoƑz肷邱Ƃ͂ł܂B́A炩̃AvP[Vx̕ϐgpOɁÄӖTdɌ邱Ƃ̂ 1 ̗RƂȂ܂B</p>




<p>Server IuWFNg\bh "MapPath" gpāAApplication_OnEnd CxgvV[WŁA΃fBNg܂͉zfBNg𕨗fBNgɃ}bv邱Ƃ͂ł܂BServer IuWFNg̏ڍׂɂẮA<link linkend="ch09-1-fm2xml"> 9 </link>QƂĂBMicrosoft ͂̐ɂĂ̗RLڂĂ܂񂪁AZLeBɊւ鐧̂߂Ǝv܂B</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
<div id="OnStart">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr valign="top">
<td class="NAME">
OnStart</td>
<td class="COMPATIBILITY">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="divider"><img src="dwres:18084" width="100%" height="1"></td>
</tr>
<tr>
<td class="usage" colspan="2"><span class="LITERAL">Application_OnStart</span>
</td></tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr><td colspan="2" class="description">
<p>Application_<!--<primary>OnStart
event</primary><secondary>Application
object</secondary>-->OnStart CxǵAŏ̃NCAg̗v󂯎Ɣ܂BApplication_OnStart CxǵA1 ̃AvP[Vɑ΂ 1 ̂݌Ăяo܂B̃CxgvV[W̃R[h "<filename>GLOBAL.ASA </filename>" t@CɕۑAt@CɊ܂܂Ă鑼̃R[hIuWFNg̃CX^X̑Oɏ܂B</p>



</td>
</tr>
<tr><td colspan="2" class="CLEARSEPARATION">&nbsp;</td></tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE">p[^</td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Ȃ</p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<span class="PROGRAMLISTING"><pre>' &lt; FROM GLOBAL.ASA &gt;
' This code resides in the GLOBAL.ASA file at the
' root of the current application. The following
' procedure is processed only once for the current
' application.
' See <link linkend="ch11-1-fm2xml">Chapter 11</link> for more details on the GLOBAL.ASA file.

&lt;SCRIPT LANGUAGE="VBScript" RUNAT=Server&gt; 
Sub Application_OnStart

' This code will run on the server when
' the application starts.
' This code retrieves the last final user count
' and uses it to initialize an Application
' variable.
Set filsysObj1 = CreateObject("Scripting.FileSystemObject")
Set tsObj1 = filsysObj1.OpenTextFile("c:\usrcount.txt", _
             True)
Application.Contents("AppUserCount") = tsObj1.ReadAll
tsObj1.Close

End Sub 
&lt;/SCRIPT&gt; 

' &lt;&gt;</pre></span>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
<tr>
<td colspan="2" class="DESCRIPTIONTITLE"></td>
</tr>
<tr>
<td colspan="2" class="description">




<p>Application_OnStart CxgvV[W݂ꍇÁAw肳ꂽ ASP AvP[ṼT[o[Ŏsŏ̃R[hƂȂ܂BāAAvP[Vx̕ϐɂ͍œKȏꏊƂȂ܂BASP AvP[VɊ܂܂Ă鑼̃R[h́AmɎsƂ͌܂B</p>




<p>AvP[Vx̕ϐ̎gpɂẮATdɌKv܂BApplication_OnStart CxgŃTCYύXAAvP[Vx̃XR[vgp邷ׂĂ̕ϐ́AAvP[V̏I܂ŃT[o[̃L܂B  </p>




</td>
</tr>
<tr>
<td colspan="2" class="CLEARSEPARATION">&nbsp;</td>
</tr>
</table>
</div>
</body>
</html>
