Main Page. VBA, ASP, Visual Basic 6.0, and VB.net. Visual C++, C#, C++, C. HTML and maybe javascript. Forum,Games and Jokes, other stuff. Submit a Tutorial Today!
ASP Tutorial - Number One

So you want to learn ASP?

Well, you've come to right place! In this tutorial I, Diftb, will guide you through an introduction of active server pages (.asp) and I'll even teach you how to create your own nifty web based app (don't I sound cool?) working with access databases. So, go and grab some coffee, pull up a chair, and join the party! Here we goooooooooo...

What is ASP?

ASP stands for Active Server Pages and was developed by Microsoft. An ASP file consists of a web page with HTML, scripting language(s), and other components. In other words, an ASP page can do many things that a plain old html can't.

Step 1: Setting Up PWS

To start this crazy journey off, you're going to need Microsoft's Personal Web Server on your computer to view your .asp files, otherwise making web pages would be a total pain because every time you wanted to test something you would have to upload your files to a web host (like brinkster) that runs servers supporting ASP. You might not know it, but you already have PWS, it's on your windows CD! Once you have it up and running you can start to make ASP pages and conquer the world (scratch that last part). Make sure you save your asp files inside the directory that you specified in the PWS setup. If you have any questions or troubleshooting problems with PWS head over to the forum and ask them.

Step 2: Your First ASP File!

Open up your favorite editor (I recommend Homesite, if you don't know what I'm talking about) and past the following write the following code (or you could just copy/paste, I won't know):

<%@ Language=VBScript %> 

<HTML> 

<HEAD> 

<TITLE>Hello, World</TITLE> 

</HEAD>

<BODY>

<%  Response.Write("Hello, world!")  %> 

</BODY> 

</HTML>

Now save this file to the your root web serving directory (by default its C:\inetpub\wwwroot) as helloWorld.asp and boot up your web browser. In the URL box type in your http://YOURMACHINENAME/helloWorld.asp. If you don't know what your machine name is open up Personal Web Server and it will have it listed. Also make sure 'start' has been clicked. When you load up the website it should look something like this. If it doesn't you've not configured something right.

Step 3: Debunking the Code

Lets take a look at the code and what it means:

1	<%@ Language=VBScript %> 

2	<HTML> 

3	<HEAD> 

4	<TITLE>Hello, World<./TITLE> 

5	</HEAD>

6	<BODY> 

7	<%  Response.Write("Hello, world!")  %> 

8	</BODY> 

9	</HTML>

Line 1: This tells the browser that everything inside the <% %> tag will be in VBSCRIPT. It is optional, if it is not there than the browser will assume you are using VBSCRIPT.

Line 2: Basic HTML beginning statement.

Line 3: HEAD

Line 4: Writing the title of the page

Line 5: Closing the HEAD.

Ling 6: Beginning BODY.

Line 7: Response.Write is the VBScript output code. In this instance we are outputting Hello, World!

Line 8 & 9: Closing the page.

Conclusion:

You've made your first basic ASP page. It may not seem like you know much but you've got the basics down. Welcome to the exciting world of web design!

Next Time:

Browser Detection and working with Forms!

Diftb can be reached at Edward@thedecline.com

 

Binary Central by Anman: "http://www15.brinkster.com/anman/"