Getting Started with ASPBy Akshay Luther
Welcome to the wonderful and exciting world of ASP. This article is focussed on passing on knowledge and information that I have had to acquire the hard way in a nice compact high-powered package. For more beginner-level ASP information, also be sure to check out the Beginner ASP FAQs on 4Guys.
Skip the next few paragraphs if you already know what ASP and are familiar with the client/server model for web applications.
Thus very powerful web applications can be built by combining scripts built with ASP that communicate with databases and use ActiveX components. An e-commerce storefront is a classic example. Now if all that didn't get you excited to the point of jumping out of your seat ... maybe you should consider a change in profession! Anyhow, simply put, ASP lets you create pages that are created dynamically, as opposed to static pages that are always the same.
As an example, an ASP called
TodaysGuide.asp in a radio station's website
is to display a list of programs that are on for a particular day. Information about
each program is stored in a database table containing the following fields:
rating etc. When the page is called via a browser
http://www.radiostation.com/todaysguide.asp, the ASP checks what day
of the week it is, pulls the relavant data from the database, formats and displays it.
Thus a different page is generated on every day of the week that the page is accessed.
This is a very simple example, and as I mentioned previously, complex applications can be
created when multiple scripts are used together.
What makes Active Server Pages convenient is the fact that they are essentially HTML pages with embedded ASP code. So an ASP contains HTML which is static as well as ASP tags which delimit ASP code. It is the code contained within the ASP tags that act on data, communicate with databases, generate HTML dynamically, use ActiveX objects etc.
Now that you know what it is and how it works, you get to learn how to make it work. The rest of the article attempts to get you started on just that. The first decision you will have to make is the language you are going to code in: you have the choice of VBScript and JScript. With additional support you can code in other languages as well, but we'll restrict our discussion to these two. VBScript is the more popular of the two for ASP. Its syntax is a little easier to use and most of the available books and tutorials use VBScript. I recommend you use VBScript for this reason. I started coding ASP in JScript simply because I was much more comfortable with its syntax and the last time I had coded in any version of BASIC was in 9th Grade. I later switched for the reason I recommend VBS even though it meant investing some time getting familiar with the new syntax. So you'd need some major motivation to use JScript! (For more information on choosing a language for ASP, be sure to read: ASP's Server-Side Languages!)
Before you can start writing your own scripts, you need to set up an environment where you can execute your scripts. If you have an NT Server setup that's not a problem, but chances are that you are running Win98 in which case you'll have to install Personal Web Server (PWS). Find it in the add-ons directory on the Win98 CD. Make sure you enable the option to install 'Microsoft Data Access Components 1.5'.
You'll also need to install some database software. Commercial sites use databases such as Oracle or Microsoft SQL Server, but for small-scale development you can use MS Access. Access 97 will do fine.
Lastly, you need an ASP editor. Yes, Microsoft again! Visual InterDev this time. Install it as an option as part of Visual Studio. You can also use Allaire HomeSite 4.5 just as well to start with - it's the most awesome non-WYSIWYG HTML editor around and has basic support for ASP. If you can't get hold of either you can use your favourie text editor, such as Notepad (if you can live with your code not being nicely coloured!).
In Part 2 we'll look at where to get some great ASP information on and off-line!