ASP Primer: Getting Started

By Joe Burns

Use these bookmarks to jump around the tutorial:

[What Do I Need?]

[How Does It Work?]

[Making Your First Page]

[What's Next?]

Well, now that you know the different ways that ASP can be used in the real world how about learning some practical stuff?

What Do I Need?

As you learned in the ASP introduction primer, ASP is a server-side technology which means that the server for your website is the sole controller of whether or not ASP is available to you. ASP is also a product of Microsoft which means it will only run on Microsoft operating systems, however, there is a third party package that will help you get around this problem. We'll talk about that later.

If you are using a hosting service or getting some free personal web space with your ISP you will want to check with them to see if ASP is available to you. You can also write a simple test page to verify whether ASP works on your server if you don't want to take the time to contact your web host.

Here is a simple page for you to enter and test for ASP:

  <%@ Language="VBScript" %>
  <% Option Explicit %>

 <!--- This page should display "ASP is working!" --->

  <!--- if ASP is available to you. --->

      <TITLE>ASP Test Page</TITLE>


      <% Dim TestString %>
      <% TestString = "ASP is Working!" %>


        <% Response.Write TestString %>


Don't worry about how the code works for now. We'll get to all of that soon enough. Be sure to save the page with the .asp extension instead of the .html extension or you will not get the desired result. The .asp extension simply let's the server know that the page is an ASP page and it should be processed accordingly. If you forget and leave the .html extension on the end then the server will just send the page on its merry way to the browser and it will never get processed. Also, ASP pages are uploaded to your websites the same way that your HTML pages are, nothing different.

Now, if you are running your own server at home or work then you will have some configuring ahead of you. First of all, you will need to have IIS up and running. IIS is available to you in various forms on any Microsoft operating system from Windows 95 on.

For those of you that are just wanting to learn and test ASP on your home computer you can install and configure Personal Web Server (PWS) and run your ASP pages locally. PWS comes with your Windows operating system. To learn how to install and configure PWS go to the Microsoft site by clicking here. This will get you started finding the right installation and set-up instructions for your particular operating system. Unfortunately, I will have to let Microsoft walk you through the installation and set-up of PWS because I simply wouldn't be able to cover all of the different operating systems in these short articles.

If you don't use a Microsoft operating system but still want to learn how to use ASP, there is a third party product out there called Chili!Soft ASP which allows you to run ASP applications on some non-Microsoft operating systems. If you are interested you can check out Chili!Soft ASP at http://www.chilisoft.com.

back to top

How Does It Work?

Now that you have a platform for running your ASP pages, hopefully, I'll bet you would like to know how the pages are actually processed. Well, it's pretty simple actually.

Each time a request is made from a browser for an ASP page the server takes a look at that ASP page to see what it (the server) needs to do. This process is referred to as interpreting. In other words, the server reads each ASP page as it is requested, interprets the code in the page and then spits out the desired result to the browser. Because of this fact, you will be the only one that can see your code on your ASP pages since only the HTML gets sent to the browser. No worries about someone "stealing" your ASP code.

While you might think that the whole process would result in a big pause while the pages are processed it really doesn't. As long as you keep your ASP pages to a reasonable length you will probably not notice any difference between an ASP page and a simple HTML page.

So, what exactly gets sent to the browser? Nothing but simple HTML. Since the browser is not a very worldly piece of software it generally only speaks a few languages, HTML and JavaScript. Therefore, ASP sends each page to the browser in HTML.

Does this mean I can't use JavaScript with ASP? No, not at all. As a matter of fact you can even use JavaScript instead of VBScript to write your ASP pages. We'll discuss that later, though.

Now, don't worry if this doesn't make perfect sense to you right now. As we move on and you get a chance to create some ASP pages of your own the whole process will become much more clear to you.

back to top

Make Your First ASP Page

Well, actually you already did. The test page code listed above is a fully functional ASP page. So, let's take a closer look at it and see what it is doing.

The first thing you probably noticed were the goofy looking <% and %> tags. Those little guys are ASP's way of telling the server that inside here is some code that needs to be looked at and processed. Also, did you notice that the ASP tags are sprinkled in and amongst the standard HTML that you are already familiar with? You'll find that most of your ASP pages will be a mixture of ASP and HTML.

You also probably noticed the <% Option Explicit %> at the top of the page. Memorize this. As a matter of practice you should always put it at the top of every ASP page that you create. It forces you to declare all of the variables in your application (we'll talk about that in greater detail later). It will save you a great deal of headache when you begin to debug you pages.

Next there is <%@ Language="VBScript" %>. This simply tells the server what language you have chosen for your ASP pages. For the purposes of this series we will be using VBScript but if you are more familiar with JavaScript please feel free to use that instead.

The next part of the page uses the Dim statement and the Response object. These are two items that we will be discussing in the next part of this series, so we'll skip them for now. If you want to play around with the page, however, feel free to put anything you want within the quotes instead of "ASP is Working!".

back to top

What's Next?

And next begins the fun part, actually learning the stuff necessary to make really cool ASP pages. In the next part of this series we will explore some of the basic elements of VBScript.

In the next part of this series we will:

  • Learn about Dim and variables

  • Learn about the If .. Then statement

  • Learn about the Case statement

back to top

<< Previous | Next >>

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
Thanks for your registration, follow us on our social networks to keep up-to-date