You've probably seen Web pages with dynamic data and information, such as accessing databases, displaying times and dates, and recalling your username for you. If you want your Web pages to be more dynamic, then read on!
With IIS, you can do a lot more than simply serve up static HTML and images on your Web pages. IIS comes with built-in languages that you can use to make pages more dynamic. The first language, Active Server Pages (ASP), is a server-side language, which means that the server interprets the code. The client receives plain HTML after the server executes the ASP code that you provided it.
If your audience is a concern, ASP is probably the best choice because the server translates it and the client receives only plain HTML. Many sites use a combination of these and other technologies to come up with an overall Web experience.
To demonstrate the simple abilities of these three languages, I show you how to insert the current date and time on your Web pages. Listing 1, page 16, is an ASP document that has the time and date in all three languages. Looking at the code, you see that the amount of coding for each language seems short. However, the complex JScript version seems to be confusing for just a date. Before you turn against JScript as a solution, let me explain the reason for this complexity. I wanted all my dates to appear in the same format (i.e., MM/DD/YYYY), and JScript has a function Date() that returns the date in a format different from ASP and VBScript. I included the complex JScript version so that you can see how you can manipulate JScript to fit your needs.
Many different ways exist for making your Web pages more dynamic. For example, using a simple If...Then statement, you can make text on your site change. In the complex JScript code, you can see that I added the If...Then statement to say Good Evening if the time was between 6:00 p.m. and 6:00 a.m., and Good Day if the time was between 6:00 a.m. and 6:00 p.m.
Obviously, you can do a lot more than just put dates on your Web pages, but such a discussion is far beyond what I talk about here. For links to great resources about how to get started, see "Related Reading," page 15.
Many readers have asked what is the best language to learn. If you know Microsoft Visual Basic (VB), VBScript will come to you easily. If you know C, JScript will seem familiar. ASP is also similar to VB, but Microsoft is replacing ASP with ASP.NET (formerly known as ASP+)—the next version of ASP and a major part of the Microsoft .NET Framework. For more information about ASP.NET, go to http://msdn.microsoft.com/net/aspnet/default.asp.
The information I provide here will help you make your Web pages more dynamic, fun, and interesting. Good luck and happy coding!
Microsoft Windows Script Technologies|
FAQs & Highlights for Active Server Pages