Introducing ASP+
Even though the ink is barely dry on the
documentation for Active Server Pages 3.0, Microsoft is already hard at work on
the next generation of their core server-side programming technology. In this chapter, we
introduce this new product, and look at what it is all about. Currently called ASP+ Next
Generation Web Services (though this name might
yet change) we'll see why we need a new version of ASP, and explore the
concepts behind its design and implementation. While this book is aimed
predominantly at experienced developers who have used ASP before, we start out in
this chapter by examining some of the core issues involved when you decide to
migrate to ASP+.
ASP+ is
designed to be backwards-compatible with earlier versions of ASP, with only
minor changes required in some circumstances (we explore these further in the
appendices). However, more to the point, you can install ASP+ on an existing
Windows 2000 server alongside ASP 3.0. This allows you to experiment with the
new version, without requiring a separate 'test bed' server. You can continue
using existing ASP applications, and migrate them ASP+ when you are ready, so
your investment in ASP is not lost.
But simply porting your applications to
ASP+ will only give you a few of the benefits the new version offers. ASP+ has
many new features that provide far greater ease of use, more power and better
runtime efficiency, but to take advantage of them you will need to understand
more about the way
that ASP+ works.
As we are writing this book using a preview
version of ASP+, we can't be exactly sure of all the features of the final
release. But thanks to the information and assistance provided by the ASP+ team
at Microsoft, we can be pretty sure that the content of the book will be
reliable and useful with the final version. We'll also be maintaining a special
Web site that is accessible from http://www.wrox.com/beta, where we'll document changes as the beta and final release
versions appear, and provide some detailed information as well.
So, in this first chapter, we'll cover:
q
How Active Server Pages has evolved
since its inception
q
What the new runtime framework is
q
How ASP+ is different to ASP, and why
q
A brief guide to getting started with
ASP+
q
Some of the changes expected in the
final release version
We start with a look at the way that ASP and
ASP+ have evolved, as this will help to set the background for understanding
and working with the new product. For more information about working with COM+
and previous versions of ASP, check out Professional ASP 3.0, (ISBN 1-861002-61-0) from Wrox.
The Evolution of Active Server Pages
Although it seems to have been around
forever, Active Server Pages is only some
three-and-a-bit years old. Since its inception in late 1996, it has grown rapidly to become the major technique for server-side Web programming in the Windows environment (and on some
other platforms using other implementations that accept the same or similar
syntax, such as ChilliASP). But it didn't come from nowhere – the foundations lie
much further back than that.
Dynamic Server-side Web Programming
Traditionally, dynamic Web pages have been
created using server-side executable programs. A standardized Web server
interface specification called the Common Gateway Interface (CGI) allows an executable program to access all the information within incoming requests from
clients. The program can then generate all the output required to make up the
return page (the HTML, script code, text, etc.), and send it back to the client
via the Web server.
To make the programmer's life easier, and
save having to create executable programs, languages such as Perl use an
application that accepts text-based script files. The programmer simply writes
the script, and the Web server executes it using a Perl interpreter.
Microsoft ISAPI Technologies
Microsoft introduced another Web server
interface with their Web server, Internet Information Server. This is the Internet Server
Application Programming Interface (ISAPI), and
differs from the CGI in that it allows compiled code within a dynamic link library (DLL) to be executed directly by the Web server. As with the CGI, the code can access all the
information in the client request, and it generates the entire output for the
returned page.
Most developments in Microsoft's Web arena
have been based on the ISAPI interface. One early and short-lived product was dbWeb, a data access technology that provided a range of searching, filtering and
formatting capabilities for accessing data stored on the server, and for
interacting with the client.
A second development was the Internet
Database Connector (IDC). This proved a big hit
with developers – not only because it was fast and efficient (unlike dbWeb), but also because it was a lot more generic
and easier to program. IDC introduced the concept of templates, allowing programmers to easily adapt existing HTML pages to use
its features and quickly build new applications around it.
IDC uses two text files for each 'page'. The first is a simple script that defines the way that
the data should be collected from the server-based database. In essence, it is
just a SQL statement plus some configuration information:
{this is the query file named getuserlist.idc}
Datasource:
GlobalExampleData
Username: examples
Password: secret
Template: getuserlist.htx
SQLStatement:
+ SELECT DISTINCT UserName
+ FROM Person ORDER BY
UserName;
The server executes this file to obtain the
results recordset, then loads a template file:
{this is an extract from the template file named getuserlist.htx}
...
<TABLE>
<TR>
<TD>User name:</TD>
<TD>
<SELECT NAME=selUserName>
<%BeginDetail%>
<OPTION
VALUE="<%UserName%>"><%UserName%>
<%EndDetail%>
</SELECT>
</TD>
</TR>
</TABLE>
...
The template is just an ordinary Web page,
including HTML, text and other objects, but with one or more specially
delimited placeholders inserted. And the syntax for these placeholders, and the
other simple program code constructs that are supported, is eerily like ASP. Of
course, it was from this that ASP actually evolved:
The Versions of ASP
So, it was in early 1996 that Denali (the codename for ASP) was released as a beta version 0.9 product,
and it took the Web-development world by storm. The ability to execute code
inline within a Web page was so simple and yet so powerful. With the provision
of a series of components that could perform advanced features, most notably ActiveX Data Objects
(ADO), it was almost
child's play to create all kinds of dynamic pages.
The final release version of Active Server
Pages 1.0, available as an add-on for IIS 3.0, was soon in use on Windows
platforms all over the place. The combination of ASP with ADO enabled developers to easily create and open
recordsets from a database. There's no doubt that this was one of the main
factors for its rapid acceptance, because now you could create and open
recordsets from a database within the script, and manipulate and output any
values, in any order, almost any way you wanted.
In 1998, Microsoft introduced ASP 2.0 as
part of the free Windows NT4 Option Pack. The major difference between this release of ASP and version 1.0
was in the way that external components could be instantiated. With ASP 2.0 and
IIS 4.0, it is possible to create an ASP application,
and within it run components in their own separate memory space (i.e. out of
process). The provision of Microsoft Transaction Server (MTS) also made
it easy to build components that can partake in transactions.
Windows 2000, COM+, and ASP 3.0
Early this year (2000), Windows 2000
arrived. This contains version 5.0 of IIS, and version 3.0 of ASP. Other than
some minor additions to ASP, the core difference here is actually more to do
with COM+. In Windows 2000, Microsoft combined MTS with the core COM runtime to
create COM+. This provides a host of new
features that make the use of components easier, as well as giving a much more stable,
scalable and efficient execution platform.
Other than a few minor changes to the
management interface, IIS has not changed a great deal on the surface. However,
underneath, it now uses COM+ Component Services to provide a better environment
for components to be executed within, including out of process execution as the
default and the option to run each component in its own isolated process if
required.
ASP+ and the Next Generation Web Services Framework
All this brings us to the present, with ASP+.
The underlying structure of ASP+ is very different to that of previous
versions, although from the 'outside' (as far as the developer is concerned) it does appear
to offer a very similar interface. ASP+ is almost entirely component-based and
modularized, and every page, object, and HTML element you use can be a runtime
component object.
For this to
perform efficiently, and provide a scalable solution, the management of these
objects is a very necessary prerequisite. The new runtime environment carries
out this management automatically, allowing ASP+ to become far more
object-oriented in nature. This lets developers build more powerful applications
by accessing these component objects in a far more granular and controlled
manner.
On top of that,
the object orientation of ASP+ provides extensibility for the environment as a
whole. Developers can add to and extend the environment, both by creating new
components or inheriting from the base classes that create them, and by
over-riding selected behavior as required. Under the hood, the COM+ runtime
manages the instantiation, pooling, and allocation of the objects automatically.