home *** CD-ROM | disk | FTP | other *** search
/ Chip 1998 February / CHIP_2_98.iso / software / pelne / optionp / iis4_06.cab / samp2v77.asp < prev    next >
Text File  |  1997-10-23  |  3KB  |  44 lines

  1.  <% If Request("DontFrame")<>1 Then Response.Redirect "/iissamples/sdk/asp/docs/SampFram.asp?ovfile=/iishelp/iis/htm/sdk/samp2v77.asp&srcfile=Simple/Components" %>
  2. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  3. <HTML>
  4. <HEAD>
  5. <META HTTP-EQUIV="Content-Type" Content="text-html; charset=Windows-1252">
  6. <title>Using Components</title>
  7. <script language="JavaScript">
  8.  
  9.     szNavVersion = navigator.appVersion
  10.  
  11.     if (navigator.appName == "Microsoft Internet Explorer") {
  12.     if (szNavVersion.indexOf ("4.") >= 0) {
  13.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie4.css">');
  14.     } else {
  15.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie3.css">');
  16.     }
  17.     }
  18.     else if (navigator.appName == "Netscape") {
  19.     document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie4.css">');
  20.     }
  21.     else {
  22.     document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/spidie3.css">');
  23.     }
  24.  
  25. </script>
  26. <META NAME="DESCRIPTION" CONTENT="Internet Information Server reference information"></HEAD>
  27. <BODY BGCOLOR=#FFFFFF TEXT=#000000>
  28. <font face="Verdana, Arial, Helvetica">
  29. <h3><a name="_using_components"></a>Using Components</h3>
  30. <p>
  31. The server components included when you install IIS provide functionality to ASP scripts in powerful, easy-to-use packages. You could spend a lot of time and resources creating and implementing this functionality with ASP scripting alone. </p>
  32. <p>
  33. You can access a component's functionality from within an ASP script in the same way, no matter which component you require. First, create an instance of the object using the appropriate and unique program ID of the component you want to instantiate. Once the instance is created, you can use references to the object to access any of the properties or methods provided by that component.</p>
  34. <p>
  35. This example uses the <b>Tools</b> object of the Tools component, which you can use to accomplish a number of miscellaneous tasks, including form processing and file ownership management. The random number generation capabilities of the <b>Tools</b> object are demonstrated here. </p>
  36. <p>
  37. The <b>Server.CreateObject</b> method is used to create an instance of the <b>Tools</b> object, using the program ID <b>MSWC.Tools</b>, and the variable <i>example</i> is set as an object reference to the new component instance. You access the desired method, <b>Random</b> in this case, by using the standard <i>object.method </i>format. Thus, each time this script is run, <i>example.</i><b>Random</b> returns a random number between -32767 and 32767. This number is then sent to the client browser. </p>
  38. <p>
  39. <b>Note</b>  This component is not installed with IIS. You can install it from the CD included with the IIS Resource Kit. The ProgID declared by the component version installed from this source specifies "IISSamples" in the vendor component of the ProgID, not "MSWC." Therefore, the <b>Server.CreateObject</b> invocation in this sample script must be modified to reflect the proper component ProgID.</p>
  40. <hr class="iis" size="1">
  41. <p align="center"><em><a href="/iishelp/common/colegal.htm">© 1997 by Microsoft Corporation. All rights reserved.</a></em></p>
  42. </BODY>
  43. </HTML>
  44.