Windows IT Pro is the authoritative and independent resource for windows nt, windows 2000, windows 2003, windows xp. Features a collection of resources and magazines for windows IT professionals.
  
  
  Advanced Search 


June 2001

Making Dynamic Web Pages in IIS

RSS
Subscribe to Windows Web Solutions | See More Active Server Pages (ASP) Articles Here | Reprints | Or get the Monthly Online Pass—only $5.95 a month!

Download the Code Here

IIS 101

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.

Two other languages that you can use with IIS are JScript (i.e., Microsoft's implementation of JavaScript) and VBScript. JScript works on many browsers, but VBScript tends to work best on Microsoft Internet Explorer (IE).

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!

Related Reading
Microsoft Windows Script Technologies
http://msdn.microsoft.com/scripting/default
.htm?/scripting/start.htm
FAQs & Highlights for Active Server Pages
http://support.microsoft.com/support/default
.asp?SD=GN&PR=asp
Learn ASP
http://www.learnasp.com
ASP 101
http://www.asp101.com

End of Article



Reader Comments
The article states a number of times that ASP is a language, which is simply not true. This is a common misconception which should be corrected here, not reinforced.

ASP is a framework which allows you to use a scripting language on the web server. From the box it supports server-side VBScript and JScript, but others are available commercially.

Angela

Angela Lamb November 27, 2003


Loved the article, any chance you know the coding for a simple .asp page displaying personal details about an individual, such as name, age... from a static html web page

Steven May 24, 2004


You must log on before posting a comment.

If you don't have a username & password, please register now.




Top Viewed ArticlesView all articles
Command Prompt Tricks

One reader shares his tip for setting up the command prompt to reflect a remote path. ...

How can I stop and start services from the command line?

...

PsExec

This freeware utility lets you execute processes on a remote system and redirect output to the local system. ...


Related Events Delivering Reliable and Effective Web-Based Applications

Making Web Application Perform Better: What to Watch, How to Watch It, and How to Fix It

Check out our list of Free Email Newsletters!

Scripting eBooks Keeping Your Business Safe from Attack: Encryption and Certificate Services

Best Practices for Managing Linux and UNIX Servers

Building an Effective Reporting System

Related Scripting Resources Become a VIP member of the Windows IT Pro community!
Get it all with the VIP CD and VIP access. A $500+ value for only $279!

Subscribe to Windows IT Pro!
Solve your toughest technical problems with our experts and access 10,000 + articles online. 30% off

Monthly Online Pass - Only $5.95!
Get instant access to 10,000+ articles from Windows IT Pro Magazine!

TechNet Virtual Labs
Evaluate and test Microsoft's newest products.


Windows IT Pro Home Register FAQ for Windows WinInfo News
Europe Edition About Us Contact Us/Customer Service Media Kit Affiliates / Licensing  
SQL Server Magazine Office & SharePoint Pro Windows Dev Pro IT Job Hound ITTV
IT Library Technology Resource Directory Connected Home Windows Excavator Windows SuperSite 
 
 Windows IT Pro is a Division of Penton Media Inc.
 Copyright © 2008 Penton Media, Inc., All rights reserved. Terms and Use | Privacy Statement | Reprints and Licensing