|
|
Session Variables
<% If Request("DontFrame")<>1 Then Response.Redirect "/iissamples/sdk/asp/docs/SampFram.asp?ovfile=/iishelp/iis/htm/asp/asps0ur7.asp&srcfile=Applications/Session" %>Session Variables
Overview
You can use the Session object to store variables that will remain available for the length of the session, and, therefore, have session scope. For instance, if you have created an online shopping application, you could define Session object variables that allow you to track how much merchandise the shopper has purchased or how much money is owed.
Code Tour
This example uses the variable SessionCount to store the number of times you have clicked the Click here to visit it again link.
Remarks
If you visit this sample several times, then visit other sections of this documentation before visiting this sample again, the count will pick up where you left off. This is because the server's Session object that is associated with your particular Web session will not be destroyed until your session has timed out.

© 1997-1999 Microsoft Corporation. All rights reserved.
-mstheme-->
| 50 |
Browser Capabilities
<% If Request("DontFrame")<>1 Then Response.Redirect "/iissamples/sdk/asp/docs/SampFram.asp?ovfile=/iishelp/iis/htm/asp/asps0zlf.asp&srcfile=Components/BrowserCap" %>Browser Capabilities
Overview
Not all browsers have the same capabilities. To make the task of accounting for differences easier, ASP provides the Browser Capabilities component. This component provides your scripts with a description of the capabilities of the client browser by use of the BrowserType object.
Code Tour
First, an instance of the BrowserType object must be created and assigned to an object variable, bc. Then, each property is requested, in turn, from the object by using the object.property syntax. Run the example, and see what your browser can do.
If you are using Internet Explorer version 5.0 or later, the list of capabilities you will see include those capabilities that are determined using the new client capabilities cookies, described in Client Capabilities.

© 1997-1999 Microsoft Corporation. All rights reserved.
 |
|
|
|
|
|
|
Simple Scripts
Simple Scripts
The following scripts illustrate the fundamental techniques used in ASP scripting. If you're a newcomer to application development, or a programmer who has never scripted before, this is a good starting place.
Choose an example from the following list:
 | Variables: Demonstrates how to create and manipulate variables in an ASP script.
|
 | Looping: Provides an example of the three most common looping constructs, For ... Next, Do ... Loop, and While ... Wend.
|
 | Conditional Operators: Illustrates the use of conditional operators, such as If ... Then, in ASP scripts.
|
 | Arrays: Demonstrates how to create, access, and manage arrays.
|
 | Server-Side Includes: Demonstrates the use of server-side includes.
|
 | Functions and Procedures: Shows how to create and utilize functions and procedures in ASP scripts.
|

© 1997-1999 Microsoft Corporation. All rights reserved.
ca">
| |
|
Web Server Creator
Web Server Creator
Overview
Server creation, deletion, stopping, starting, configuring: These are all tasks that can keep you very busy, especially if you are an administrator of a large Internet or intranet Web site. This sample tool demonstrates how you can automate many of those tasks.
Code Tour
This sample script provides a simple interface through which you can create a new Web server. Several steps are required to accomplish this, starting with invoking GetObject on the IIS://LocalHost/W3SVC node. The IIsWebService object's ADSI method Create is used to create a new IIsWebServer object. The server object is then configured, and the new information written back to the metabase with the SetInfo method.
At this point in the script, the server is not a fully functional Web site. It now has a node in the metabase, but it is not running, nor does it have a root directory in which to store anything. To finish creating the Web site, the tool creates an instance of the IIsWebVirtualDir ADSI object, then configures that object to be the new root directory for the new server. SetInfo is once again called to save the information to the metabase, and finally, if all has gone well up to this point, the server object's Start method is invoked.
Remarks
Note that almost every major statement group in this sample has its own set of error-code checking. This is important when creating any tool in general, but especially for tools that use the IIS metabase.
Location
This script is available in the Internet services directory, at ...\iissamples\sdk\admin\mkwebsrv.vbs.

© 1997-1999 Microsoft Corporation. All rights reserved.
Using Cookies
| | | |