2025-04-27 07:49:33 -04:00

223 lines
9.9 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html dir=ltr>
<head>
<title>ASP Tutorial</title>
<SCRIPT LANGUAGE="JavaScript">
<!--
TempString = navigator.appVersion
if (navigator.appName == "Microsoft Internet Explorer"){
// Check to see if browser is Microsoft
if (TempString.indexOf ("4.") >= 0){
// Check to see if it is IE 4
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else {
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
}
}
else if (navigator.appName == "Netscape") {
// Check to see if browser is Netscape
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
}
else
document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
//-->
</SCRIPT>
<link disabled rel="stylesheet" href="cocss.css">
<SCRIPT LANGUAGE="VBScript">
<!--
Sub Window_OnLoad()
Dim frmContents
On Error Resume Next
If Not Parent Is Nothing Then
Set frmContents = Parent.Contents
If Not frmContents Is Nothing Then
frmContents.Window.TOCSynch_Click
End If
End If
End Sub
//-->
</SCRIPT>
<META NAME="DESCRIPTION" CONTENT="Introduction to the self-paced, interactive ASP tutorial.">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=Windows-1252">
<META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
<META NAME="MS.LOCALE" CONTENT="EN-US">
<META NAME="MS-IT-LOC" Content="Internet Information Services">
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="Verdana,Arial,Helvetica">
<h1><a name="H1_37685983">ASP Tutorial</a></h1>
<p>
You can use Microsoft® Active Server Pages (ASP) to create
dynamic and interactive Web pages. An ASP page is a Hypertext Markup Language (HTML) page that contains script commands that are processed by the Web server before being sent to the client's browser. This explains how the term "server-side script" originated.
</p>
<P>
HTML is the simplest language for writing Web
pages, but it allows you to create only static Web pages. When a Web client requests a static HTML file from a Web server, the
Web server sends the HTML file directly to the client without any computation being done (Figure&nbsp;1). The client's browser then processes the HTML code in the file and displays the content.
</P>
<TABLE align=center>
<tr><td><IMG src="art/00_01.gif"></td></tr>
<tr><td>Figure 1</td></tr>
</TABLE>
<p>
VBScript is the simplest language for writing ASP pages. All the code
samples in this tutorial are written in VBScript except for samples that are
duplicated in JScript for comparison.&nbsp;When a Web client
requests an ASP file from a Web server, the Web server sends the ASP file through
its ASP engine, where all the server-side script code is
executed or converted into HTML code (Figure&nbsp;2). The converted code is then sent to the Web
client.
</p>
<TABLE align=center>
<tr><td><IMG src="art/00_02.gif"></td></tr>
<tr><td>Figure 2</td></tr>
</TABLE>
<p>
Unlike conventional Common Gateway Interface (CGI) applications, which are
difficult to create, ASP is designed to greatly simplify the process of
developing Web applications. With a few lines of script, you can add database
connectivity or advanced customization features to your Web pages. In the past,
you had to know PERL or C to add such functionality, but with ASP you can use
ordinary Web scripting languages such as Microsoft JScript (Microsoft's
implementation of the ECMA 262 language specification), Microsoft Visual Basic®
Scripting Edition&nbsp;(VBScript), or any COM-compliant scripting language,
including JavaScript, PERL, and others.
</p>
<p>You can dramatically extend the power of ASP by using Component Object Model (COM) components in your ASP pages. COM components are pieces of compiled code that can be called from ASP pages.&nbsp;COM components
are secure, compact, and reusable objects that are compiled as DLLs.&nbsp;They can be written in Visual C++, Visual Basic, or other languages that support COM.
</p>
<p>
The tutorial includes the following modules:
</p>
<ul>
<li>
<B><A href="AspTut01.htm">Module 1: Creating ASP Pages</A></B>&nbsp;&nbsp;&nbsp;In this module, you write and run your first ASP pages, create
data-gathering forms, connect to a database, and display a Microsoft Excel spreadsheet. You should have some familiarity with creating HTML pages before you begin.
</li>
<li>
<B><A href="AspTut02.htm">Module 2: Using COM Components in ASP Pages</A></B>&nbsp;&nbsp;&nbsp;In this module, you use some of the COM components that are
included with Active Server Pages to rotate Web
advertisement banners and to record traffic at your Web site.
</li>
<li>
<B><A href="AspTut03.htm">Module 3: Maintaining Session State in a Web Application</A></B>&nbsp;&nbsp;&nbsp;In this module, you learn different methods you can use to maintain session state in ASP.
</li>
</ul>
<h2>Before You Get Started...</h2>
<p>
This three-module tutorial provides step-by-step procedures and samples to help you implement ASP using VBScript.&nbsp;To load and run the tutorial samples, you must have administrator privileges on the computer running IIS.&nbsp;The default IIS security settings should allow you to run the tutorial, but you may need to
change your security settings if you encounter access violations.
</p>
<P>If you get an error when you open an ASP page in the browser, try the
following:
<ul>
<li>
Close the ASP file in the text editor. The
server may not be able to display an HTML page that is open in a text editor.
</li><li>
Make sure the file with the correct name and extension exists in
<i>x</i>:\InetPub\Wwwroot\Tutorial.
</li><li>
Look at the spelling of the URL in the address bar of your browser,
and correct it if necessary. It should resemble http&#58;&#47;&#47;localhost&#47;Tutorial&#47;<i>MyFile</i>.asp
or http&#58;&#47;&#47;<i>ComputerName</i>&#47;Tutorial&#47;<i>MyFile</i>.asp.&nbsp;
</li><li>
Verify your Web server is running. A quick way to do this is to type
<a href="http://localhost/localstart.asp">http://localhost/localstart.asp</a>
in the address bar. If you receive a <B>The page cannot be displayed</B> error,
your Web service may not be running. To start the Web service , click
<B>Start</b>, click <b>Run</B>, and in the <b>Open</b> text box, type <B>cmd</B>. In the command window, type <B>net start w3svc</B>.
</li>
</ul>
If your problem persists, you do not have a generic error. Carefully read the error displayed in your browser to see whether you can determine where the error is coming from. Following are examples of possible errors and their explantations:
<ul>
<li><B>Server Error</B>&nbsp;&nbsp;&nbsp;The error is coming from IIS.</li>
<li><B>VBScript</B> or <B>JScript Error</B>&nbsp;&nbsp;&nbsp;The error is probably
a coding error.</li>
<li><B>ADODB</B>&nbsp;&nbsp;&nbsp;There may be a problem with your
database.</li>
<li><B>Security</B> and <B>Access Denied</B>&nbsp;&nbsp;&nbsp;These errors are more subtle, and you need to check the permissions for your files and folders, especially
for database files that require Read/Write access if you are altering
data.</li></ul>
<P>
Web permissions are set in IIS with the <a href="iiabuti.htm">IIS snap-in</a>. However,
those permissions can be undermined by NTFS permissions on specific files and
folders. You may allow a user access to your Web site in IIS, but if NTFS file
permissions deny access to an ASP file or a database file, your Web user does
not see the file. If you are using Anonymous authentication, you must set NTFS
permissions to allow access to the IWAM_<i>ComputerName</i> and IUSR_<i>ComputerName</i>
accounts. Please see the sections in IIS Help about security and setting
permissions, and see the <a href="http://www.microsoft.com/isapi/redir.dll?prd=technet&ar=iis" target="_blank">IIS
TechNet</a> articles about NTFS Security.
</P>
<p>
If you did not customize your installation of IIS, <i>x</i>:\Inetpub\Wwwroot was
created as the default home directory, where <i>x</i> is the drive on which you
installed Windows.&nbsp;In <i>x</i>:\Inetpub\Wwwroot,
make a directory called <b>Tutorial</b>.&nbsp;As you work through
the lessons in each module, save your work in the <i>x</i>:\Inetpub\Wwwroot\Tutorial
directory.&nbsp;View your work through your Web server by
typing http&#58;&#47;&#47;<b>localhost&#47;Tutorial&#47;<i>file_name.asp</i></b> in your browser, where <i>file_name.asp</i> is the name of your file.</P>
<p>
By default, Internet Explorer displays generic messages when there is an error
in a Web page.&nbsp;You will want to see detailed error messages in Internet Explorer, so you need to
disable the Internet Explorer feature that bypasses the errors sent from IIS. In
Internet Explorer, click the
<B>Tools</B> menu, select <B>Internet
Options</B>, click the <B>Advanced</B> tab, and clear the
<b>Show Friendly HTTP Error Messages</b> check box.
</p>
<p>
This tutorial does <em>not</em> contain:
</p>
<ul>
<li>
Complete language information for VBScript and JScript,&nbsp;or topics on
writing ASP scripts; see <A href="iiwawelc.htm">Active Server Pages</A> or
<A href="http://go.microsoft.com/fwlink/?LinkId=1758" target=_blank>Windows Script Technologies</A>.
</li>
<li>Complete reference pages for all the built-in ASP objects; see
<A href="iiwaobb.htm">Built-in ASP Objects</A>.
</li>
</ul>
<p>&nbsp;</p>
<hr class="iis" size="1">
<p align="center">
<em><A href="/iishelp/common/colegal.htm">© 1997-2001 Microsoft Corporation. All rights reserved.</A></em>
</p>
</font>
</body>
</html>