Published: Friday, January 07, 2000
A Look at ASP 3.0
| For More Information... |
|
This article provides only a quick, high-level view of the new features in ASP 3.0. If you
are looking for an insanely in-depth, low-level look at what's new in IIS 5.0/ASP 3.0, be
sure to check out: Leveraging
ASP in IIS 5.0. For in-depth articles on some of ASP 3.0's new features check out:
|
What ASP version do you use? Chances are you are using ASP 2.0, which is the version used
with IIS 3.0 and 4.0. If you are currently running a version of Windows 2000, then you are
using IIS 5.0, and are privy to using ASP 3.0. For those of us who are not part of the
Windows 2000 Beta program, the wait for ASP 3.0 is drawing to a close.
Microsoft has officially announced that they will release Windows 2000 on February 17, 2000,
just weeks away! Windows 2000 provides many new services and features; two of these are
IIS 5.0 and ASP 3.0. While ASP 3.0 does not differ drastically from ASP 2.0, it does have
some noteworthy enhancements. Let's look at some of the additions:
Server.Transfer
(view the technical
docs) -
this new method transfers control to another ASP page.
This can be used in place of Response.Redirect. For example, imagine that
you wanted to perform some processing and then send a user to a new URL. With ASP 2.0, you
would perform your processing, then use Response.Redirect to send the user
to the new URL. The problem with this is that Response.Redirect is sloppy -
it first sends a message to the client telling the web browser to load a new URL. The
browser reads this request, then sends a request back to the web server for the new URL.
The web server then processes the new URL and sends the HTML to the client.
That's a lot of network traffic going on there. Server.Transfer switches
control to another ASP page on the web server, behind the scenes, preventing the extraneous
network traffic. Here is a code snippet that shows how Server.Transfer can be
used:
'Do processing...
'Send the user to DoneProcessing.asp
Server.Transfer "/scripts/DoneProcessing.asp"
|
Server.Execute
(view the technical
docs) - The Execute method of the Server object is similar to
the Transfer method in that in redirects control from one ASP page to another.
Unlike the Transfer method, however, the Execute method
returns control to the calling ASP page when the called page completed executing.
OK, I know this sounds a bit confusing. Imagine it this way: Page1.asp contains the following
code:
Response.Write "Hello, "
Server.Execute "Page2.asp"
Response.Write "World!"
|
whereas Page2.asp contains the following code:
Response.Write "Good morning!"
|
When Page1.asp was visited via a browser, first the output Hello would be sent
to the client. Next, Page2.asp would be executed, resulting in sending the client
Good morning!. Finally, control would return to Page1.asp where it left off,
and World! would be sent to the client. The end result? The client would see
the following output:
Hello, Good morning!World!
|
The client has no idea that, behind the scenes, Page2.asp is called. There is no refresh
or redirect in the browser, since all of this takes place server-side.
There are some additional new features to ASP 3.0, such as the ASPError object.
These will be discussed in great detail in Part 2.
If you are interested in learning ASP 3.0, and are new to ASP, let me recommend a book that
James Atkinson (one of the other
4GuysFromRolla) and I (Scott Mitchell)
wrote:
Teach Yourself Active Server Pages 3.0 in 21 Days. Note that this book is for
beginners; it will be available in early February, 2000, but can be purchased on-line
now. If you are experienced with ASP and want to learn about ASP 3.0, let me
suggest Wrox's
Professional Active Server Pages 3.0.
Read Part 2