Essential ASP for Web Professionals (Prentice Hall Essential Web Professionals)

4 avg rating
( 1 ratings by GoodReads )
9780130304995: Essential ASP for Web Professionals (Prentice Hall Essential Web Professionals)

This concise, practical, example-rich guide teaches Web developers exactly what they need to know to achieve high-quality results with Microsoft's Active Server Pages and JavaScript -- immediately. Endorsed by the World Organization of Webmasters, Essential ASP for Web Professionals offers no-nonsense, practical coverage designed around real-world examples you can see working on a live sample site. Leading Web developer Elijah Lovejoy teaches Web developers exactly what they need to get up-and-running fast -- from the basics of embedding ASP code in HTML pages to full-blown application development. Essential ASP for Web Professionals walks you through these and other real-world examples: shopping carts, database applications, sending email from Web pages, creating guest books, and embedding variable information such as dates in Web pages. Every chapter includes practical overviews of relevant ASP and JavaScript features, reinforcing all that's been learned. Essential ASP for Web Professionals comes with a free web site that includes additional projects and solutions, downloadable code, images, additional in-depth explanations, and other valuable resources.

"synopsis" may belong to another edition of this title.


Although at least half as long as other titles on the subject, Essential ASP for Web Professionals is probably just as valuable for getting started with ASP. Aimed at the beginning or intermediate Web developer, this is an extremely useful, cookbook-style tutorial that helps readers of all levels use ASP (and JavaScript) to create Web pages dynamically by concisely offering a series of simple, effective ASP examples. The full source code is included, along with extensive annotations and suggestions for extending the code in custom projects. This approach is ideal for anyone who appreciates a hands-on approach to learning.

The examples themselves are immediately practical. First off, a date-time script--and an example--gives out a random "tip of the day" read from a text file on the server. Then it's on to basic database programming with ADO and ASP. After a quick tour of database basics, readers learn some expert techniques for generating forms based on any database table without changing ASP code. (Not only will you be able to easily generate HTML forms on the fly, you'll also find out how to update databases from forms automatically--again without changing ASP code.) This flexible, "soft" approach to working with databases will help you write ASP code that's a lot easier to maintain.

The book culminates in a full-featured shopping cart example for an e-commerce site. Techniques demonstrated include maintaining state with cookies. Throughout, the book does a fine job of showing how ASPs often work together to get the job done, instead of creating monolithic (and unmaintainable) scripts. For instance, the shopping cart example uses no less than 11 ASP files. (A quick "site map" diagram shows the organization.) Besides the basics, Essential ASP also offers a guide to some best practices, ensuring you'll learn the right way to do things, as well as pick up the basics quickly.

Efficiently packaged, yet filled with some very useful code, this is a truly worthwhile tutorial for ASP development that's exactly what the busy Web professional needs to get started with this powerful standard. --Richard Dragan

Topics covered:

  • Example-based ASP programming tutorial
  • Introduction to Active Server Pages (ASP) created with JavaScript
  • Programming with JavaScript date and time functions
  • Working with text files
  • Introduction to databases
  • Tables and records
  • Writing form data to text files (using ADO with ASP) and data-driven Web pages
  • Editing, updating, and deleting database records
  • Techniques and tips for building data-driven forms
  • Implementing an e-commerce shopping cart with ASP (complete sample code and programming tips)
  • Managing sessions with cookies
  • Sending e-mail with CDONTS and ASP
  • Short reference guide to JavaScript

From the Inside Flap:


Welcome to the book.

This is an ASP cookbook. Each chapter contains one or more recipes that work together in a useful way. Briefly:

Chapter 1 is basically a tutorial, with a couple of very simple scripts that add dates to HTML pages.

Chapter 2 has two recipes: a tip-of-the-day application (a quick and dirty way to add dynamic content to a Web page) and a guest book.

Chapter 3 has a complicated recipe for publishing the contents of a database onto a Web site.

Chapter 4 has a more complicated recipe that creates a Web site that lets you edit the database.

Chapter 5 has a recipe for a shopping cart. It's the most complicated recipe in this book and the one that's most likely to make you some bucks.

Chapter 6 gets simple again with a recipe for e-mail.

All of these recipes rely on Active Server Pages (ASP) and JavaScript, which is mostly what this introduction is about.Before Active Server Pages

Tim Berners-Lee started things off with a great way to publish documents called HTML, which is a wonderful way to publish static documents.

Pretty quickly thereafter, something called CGI was added to Web servers to let programmers generate HTML pages on the fly. With CGI, when the Web server gets a request for page, it starts a program and hands the request to the program. If the program generates any output, that output is returned to the browser.

CGI is a pretty great way to do a lot of things, but it's a very program-ish solution, which is to say it's not very HTML-ish. When you look at a CGI program, most of the time, it doesn't look much like an HTML page, even though that's usually the end result. And if there's a lot of HTML in the program, a lot of the time it has to be carefully wrapped in quotes to separate the program parts from the HTML parts, which can get tiring.Too Many CGI Scripts in the Kitchen

Then there's the performance issues: Most CGI programs are written using scripting languages like Perl, which is ideally suited for this kind of thing.

The problem with this is that every time a Web browser asks for a Web page that's generated by a CGI program, a new process is launched on the server. Launching new processes is kind of slow and takes up a lot of resources. Programs with too many simultaneous CGI programs can get very bogged down.

There are, of course, ways around this, but they involve doing fancy technical things that are a lot harder than writing Perl scripts.

So it became clear that there needed to be an easier way to generate dynamic Web pages.Mixing HTML and Scripts in One Place

The solution that has emerged to the HTML vs. CGI debate is to do both. Increasingly, Web servers are getting smarter, so that it's possible to drop little program snippets inside of Web pages instead of having to maintain programs and HTML separately.

This isn't the end-all, be-all for the Web. Small sites that don't need dynamic content should still be created with HTML.

Very large sites with millions of pages and complicated applications need to be built using complicated publishing systems and application servers.

But for a lot of things, being able to mix HTML and programming is an excellent solution. And that's what ASP is all about.

ASP is probably the best way to mix HTML and simple programming in a Windows environment. ASP pages can also be hosted on a UNIX server, using software from ChiliSoft. But most people use ASP with Windows NT and Windows 2000, because it's built into IIS, it's easy to use, and it's powerful.

ASP is not the only game in town. Other products that let you mix HTML and programming include PHP, Cold Fusion, and JSP. But if you're interested in building dynamic product on the Windows platform, you'll find that ASP is often the first choice for developing dynamic Web sites.How to Add ASP Code to an HTML Page

If you're comfortable with HTML source code, adding ASP to your arsenal will feel like the logical next step.Warning

This book assumes that you are comfortable with HMTL source code. If you are not familiar with HTML source code, you will want to get a good HTML book to refer to while you work with this book.

Let's start with a real simple HTML page called hello_world.html:

Hello World

Hello World

If your Web server is IIS (you need IIS or a Web server that supports Active Server Pages for this to work), you can take this file and rename it hello_world.asp:

<%@ Language=JavaScript %>

Hello World

<% Response.Write("Hello World") %>

Three things have changed:

Instead of ending with .html, the file now ends with .asp. This tells the Web server that there may be some code on the page. Instead of just giving the page to a Web browser when someone types in the URL of the page, the Web server checks the page for <% ... %> tags first. If it finds any, it removes the tags and their contents, and replaces them with the output of any program that is inside of them.

The first piece of code that the Web server finds is <%@ Language=JavaScript %>. This tells the Web server that the programming language is JavaScript. Because IIS, the Microsoft Web server, often assumes that ASP programs will be written in VBScript, it's always a good idea to tell IIS if you're using JavaScript.

The next piece of code that the server finds (remember that it's looking for <% ... %> tags) is the line <% Response.Write("Hello World") %>. The Response.Write() command is a lot like the print() command in many programming and scripting languages. In the context of ASP, this code tells the server to send the string "Hello World" to the browser.

The net result is that the .asp page and the .html shown above have exactly the same result: a Web page with the words "Hello World" on it.

Nevertheless, the two pages are very different. When a browser asks the Web server for an .html page, the server passes the page to the browser without much thinking about it. On the other hand, the Web server looks at .asp pages to check for small programs to run. This means that any or all of the contents of an .asp page can be generated on the fly. This book will explore how this can be useful.Why JavaScript?

Most books about ASP use the VBScript scripting language. Rather than use VBScript, this book uses JavaScript, for a number of reasons:

Active Server Pages can be written in VBScript, JavaScript, as well as PerlScript. Because all work pretty much equally well for most things, deciding which language to use is pretty much a matter of taste.

I'm more used to working in JavaScript than in VBScript, so it's often easier for me to use JavaScript.

JavaScript is the only practical language to use for client-side programming. I find the idea of switching from one language to another annoying. By using JavaScript on the server side, I can use the same language on both sides. Of course, the browser environment is very different from the ASP environment. Still, using a single language keeps my life simple. Especially because I do hardly any client-side scripting, because it never seems to work right, and figuring out the difference between all the browsers is something I never seem to get around to.

JavaScript is an open protocol. VBScript is not.

There are a lot of JavaScript programmers out there and not a lot of resources for using JavaScript on the server side. When I got an opportunity to write a book on ASP, it seemed like a good opportunity to tip the balance the other way. What's the Difference between JavaScript, JScript, and ECMA Script?

JavaScript first emerged on the scene as a scripting language for the Netscape browser. Later, when you could use JavaScript with Microsoft Internet Explorer, I think they called it JScript (at any rate, Microsoft often calls it JScript now).

Because Netscape and Microsoft couldn't agree on how JavaScript/Jscript should work, it was hard to do anything besides rollover buttons that would work reliably.

For the last couple of years, there's been something called ECMA Script that's supposed to be an open protocol that will bring everything back together or something.

Because all the code in this book was written for Microsoft Active Server Pages, it seems likely that one could argue that the code is JScript. Yet, this book talks mostly about JavaScript, rather than JScript. I've been able to find two reasons why: First, I think JavaScript sounds better than JScript; Second, the code that I use in my scripts to declare the language is <%@ Language=JavaScript %>. And this works.

Whatever.ASP Objects and Other Useful Objects

The reason that ASP, IIS (the Microsoft Web server), and JavaScript are worth using is that they make it easy to create a script quickly, using a suite of tools that let us limit our focus to the specific task confronting us without having to reinvent the wheel.

When our script needs to perform a task, the bulk of the task can often be performed by a built-in ASP object, Microsoft scripting object, or JavaScript object. Some of the important ones are listed below.A Quick Look at ASP

One of the tasks that used to be a real hassle in the early CGI days was collecting information from a form. For example, if a form collects a variable called email that contains an e-mail address, you can easily access it with the Request object:email_address = Request("email");

Another fun trick is the ability to redirect a visitor to a different page, using the ASP Response object:Response.Redirect("lovejoy/redirect_page.asp");

which is a lot faster way to redirect someone than using a tag.

And, of course, there are a lot of other neat tricks that make it fun and worthwhile to work with ASP and JavaScript! Thus, this book...A Quick Tour of the More Important Objects

As the name implies, ASP objects are collections of logically related methods and properties. The table below lists the most commonly used ASP objects and the purposes they serve.

ASP Object Purpose

Request Manages information about the request that the browser sends to the Web server. Often, the most important element of this request is incoming form information.

Response Manages information that is being sent to the browser in response to the browser's request to the Web server. For example, the Response.Write() command can be used to send HTML to the browser.

Server Manages information that is related to the server. For example, the Server object can be used to find the URL of the current script.

Session Manages information about a user's total visit. For example, if a user looks at five pages when visiting a site, the Session object can be used to keep track of that user as she looks at the five pages.

In addition to objects that are unique to ASP, it is possible to use Microsoft scripting objects from within the ASP environment. For example:

Microsoft Scripting Object Purpose

FileSystem Can be used to read and write information to and from the filesystem, including looking at the contents of existing files and creating new files.

ADODB A database technology that can be used to read and write information stored in databases such as MicrosoftAccess, Microsoft SQL Server, or Oracle.

CDONTS Contains an object called NewMail that can be used tosend email from a script.

Finally, the JavaScript language includes some built-in objects that help with certain tasks. For example:

JavaScript Object Purpose

Date Does the legwork necessary to work with dates—who has time to keep track of days, months, years, etc...?

Math A variety of useful math tricks such as generatingrandom numbers and rounding off real numbers.

How to Use This Book

This book consists of a series of fully working programs that can usually be set up in a matter of minutes. Unlike CGI scripts, where you often have to worry about permissions and other configuration issues, the ASP scripts in this book can be FTPd to just about any Windows NT or Windows 2000 server (or even a Win95/98 PC with personal Web server installed) and be up and running immediately.

If you're new to Web scripting/programming, it's probably a good idea to use Chapter 1 as a tutorial.

After that, this book can be used as a cookbook: Simply jump directly to the script that looks interesting or otherwise meets your needs, and you should be up and running quickly, whether you're a novice or an experienced programmer working with ASP for the first time.

The appendixes contain reference information on topics that relate in one way or another to getting ASP scripts up and running quickly and easily.Conventions

All code examples are identified by the use of the Courier fixed width font. If there are line numbers next to an example of code:


// Some code examples


// have line numbers next to them.


The code will usually be followed by detailed explanations of how the code works.

Note that, in some cases, a line of code will wrap to the next line. That does not mean that there is a line break in the code! You can generally tell a wrapped line because there is no line number next to the part of the line that has wrapped. Putting a line break where a line wraps can cause some odd behavior that's surprisingly difficult to track down, so be careful with this one. Don't want to worry about line breaks? Don't! Go to the companion Web site and download the code: phptr/essential/.How Chapters Are Structured

Each chapter is structured as follows:

Introduction: Some kind of effort to give you a sense of what the chapter is about.

New Features: A description of any new ASP or JavaScript features that will be used in the code.

Source Code: The source code is listed, followed by a detailed description of how it works.

Recap: A brief summary of what was in the chapter.

Advanced Projects: Some ideas on how you could hack the script presented in the chapter.

This book assumes that you've got at least a passing familiarity with HTML. If you haven't worked directly with HTML before, you'll probably want an HTML resource to turn to. Case Sensitivity

JavaScript is case-sensitive. sO be cAreful about how you type things. If something doesn't work right, you can explore changing the case...

"About this title" may belong to another edition of this title.

Top Search Results from the AbeBooks Marketplace


Lovejoy, Elijah
Published by Prentice Hall PTR (2000)
ISBN 10: 0130304999 ISBN 13: 9780130304995
New Paperback Quantity Available: 1
Irish Booksellers
(Rumford, ME, U.S.A.)

Book Description Prentice Hall PTR, 2000. Paperback. Book Condition: New. book. Bookseller Inventory # 0130304999

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 32.61
Convert Currency

Add to Basket

Shipping: FREE
Within U.S.A.
Destination, Rates & Speeds


Lovejoy, Elijah
ISBN 10: 0130304999 ISBN 13: 9780130304995
New Quantity Available: 1
Castle Rock
(Pittsford, NY, U.S.A.)

Book Description Book Condition: Brand New. Book Condition: Brand New. Bookseller Inventory # 97801303049951.0

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 36.81
Convert Currency

Add to Basket

Shipping: US$ 3.99
Within U.S.A.
Destination, Rates & Speeds


Lovejoy, Elijah
Published by Prentice-Hall
ISBN 10: 0130304999 ISBN 13: 9780130304995
New Quantity Available: 1
Majestic Books
(London, ,, United Kingdom)

Book Description Prentice-Hall. Book Condition: New. pp. 304. Bookseller Inventory # 5818128

More Information About This Seller | Ask Bookseller a Question

Buy New
US$ 44.24
Convert Currency

Add to Basket

Shipping: US$ 6.72
From United Kingdom to U.S.A.
Destination, Rates & Speeds