ASP Primer: Getting Started
WEBINAR: On-demand webcast
How to Boost Database Development Productivity on Linux, Docker, and Kubernetes with Microsoft SQL Server 2017 REGISTER >
Well, now that you know the different ways that ASP can be used in the real world how about learning some practical stuff?
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:
<% 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
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.
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
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.
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
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