Free Webmaster Help Logo
Tutorials Articles Tools Images Directory Ask Newsletter
*
 

Tutorials
Cookies
ASP
Advanced HTML
Frames & Tables
.htaccess
Rounded Table Corners
Flash 5
FTP
Beginners
Javascript
PHP/MySQL
Site Promotion
Mobile Internet: WML/WAP
Server Side Includes (SSI)
HTML - The Basics
XHTML
Stylesheets
XML
PHP
*

125x125

Related Links
More ASP Sites
*

 
Sitemap | Contact | Link To Us | Advertise
Report A Problem
Home : Tutorials : ASP : Part 1

ASP Tutorial
Part 1 - Introducing ASP

Introduction

For any webmaster, once you have created a page with graphics and content, the next logical step is to make it interactive. You can, of course, go to one of the remotely hosted scripting sites who will provide you with a simple piece of code to put on your site, but there is a lot more flexibility if you can create and install your own scripts which will do exactly what you want.

It's thought by many that this 'server-side scripting' (it is processed by the server and not the browser, so unlike JavaScript the use of ASP doesn't depend on someone's browser supporting it) is very difficult to learn, and this has come from the early languages like Perl, which are difficult to write and even more difficult to debug. Over the past few years two new languages have emerged, PHP and ASP. These are easy enough for even the novice webmaser to learn.

What Is ASP?

ASP stands for Active Server Pages. It is basically a server-side scripting language designed for the Windows Platform, although it is available on Unix/Linux systems through new systems, although PHP is the more popular choice for this platform. Active Server Pages is based around VBScript, a variant of Visual Basic, which makes it very easy to use as the majority of the commands are plain English and simple to decipher.

As mentioned earlier, ASP is a server-side scripting language. Basically what this means is that if an ASP page is requested, the web host server will process it and run all the ASP code, before sending the output to the browser. This has two major advantages over client-side (processed by the browser) scripts like JavaScript. The first is that there are no compatibility problems. It doesn't matter if the user is using the latest browser or the oldest, they will see the same output. The second is that your code is hidden. Because code is executed on the server, users only ever see the output, so it is safe to put passwords etc. in your ASP code.

What Do I Need?

ASP is a server-side language, so you will need to make sure that your web server has the correct software for running it. The most common setup for running ASP scripts is on a Windows-based server running IIS (Internet Information Server). It is possible to use Linux-based systems, though, but they must have the Chillisoft ASP package installed. Most web hosts will publish whether they support ASP, but if in doubt contact your systems administrator. If you need a free web host supporting ASP, try visiting Free-Webhosting.info.

Once you have the server ready to accept scripts, running one is as easy as simply uploading and running the file. You don't need to put it in any particular place on the server or change any settings. Just upload and run.

ASP Code

When writing ASP you don't need to worry about changing all your HTML, you simply add ASP code into your HTML pages where needed. YOu also don't need any special software on your computer, a simple text editor will do. To begin an ASP page you will first need to tell it what language you have written it in. The most common (and the one used in this tutorial) is VBScript. You should begin your page with:

<%@ Language=VBScript %>

All this code does is tell the ASP system that you are writing your page in VBScript. You will notice that the ASP code is enclosed in special tags. All ASP code should be enclosed in the 'percent sign tags' in the form:

<% ASP Code Here %>

Code can be written over multiple lines, but any code not enclosed in the ASP tags will simply be treated as HTML. Similarly and HTML inside these tags but not specifically sent as output by the code will cause an error.

Testing ASP

Before you start writing scripts it is a good idea to test whether ASP will run correctly on your server. Make a simple page with the following:

<html>

n<head><title>Test Page</title></head>
<body>
This is some HTML. Below this I have ASP<br>
<%@ Language=VBScript %><br>
Nothing should appear above here.
</body>
</html>

and save it as test.asp. Then upload this to your server and access it with your browser. If it has worked correctly, the page should display and you should only see the lines:

This is some HTML. Below this I have ASP

Nothing should appear above here.

If the ASP appears in the page or the source of the page, something has gone wrong. Check the code and also the settings on your server. No ASP should appear as it should have been processed by the server before it was sent to the browser.

Part 2

In part 2 I will go into more depth about how to use ASP and explain about sending output to the user, variables and some other commands you can use.

© 1999 - 2001 FreeWebmasterHelp.com