ASP Programmer's Reference

( 1 )

Overview

What is the Subject Area?

This book provides a reference to Microsoft Active Server Pages version 2.0, one of the key technologies underpinning the Microsoft Web Server, Internet Information Server 4. ASP allows server side scripting to dynamically construct web pages, interact with server based components, such as business objects, and manipulate databases.

What's Great About this Book?

  • Provides a concise ...
See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (17) from $1.99   
  • New (2) from $31.42   
  • Used (15) from $1.99   
Close
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any BN.com coupons and promotions
$31.42
Seller since 2014

Feedback rating:

(272)

Condition:

New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.

New
Brand New Item.

Ships from: Chatham, NJ

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
$45.00
Seller since 2014

Feedback rating:

(160)

Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Page 1 of 1
Showing All
Close
Sort by
Sending request ...

Overview

What is the Subject Area?

This book provides a reference to Microsoft Active Server Pages version 2.0, one of the key technologies underpinning the Microsoft Web Server, Internet Information Server 4. ASP allows server side scripting to dynamically construct web pages, interact with server based components, such as business objects, and manipulate databases.

What's Great About this Book?

  • Provides a concise and yet comprehensive guide to the ways ASP 2 can be used in all kinds of applications.
  • Details the standard server components, how they are used, and how they interact.
  • Briefly details the use of databases with ADO.
  • A liberal sprinkling of code samples to explain the topics.
  • Includes a reference section for fast access to detailed lists of the objects, properties and methods available.

Who is this Book for?

This book is aimed at the web site developer who needs a comprehensive reference to ASP, and is suitable for both beginner and experienced ASP developer alike. Its reference style is aimed to provide quick access to specific content, with code samples to explain the techniques used.
Read More Show Less

Product Details

  • ISBN-13: 9781861002457
  • Publisher: Wrox Press, Inc.
  • Publication date: 11/5/1998
  • Pages: 400
  • Product dimensions: 6.05 (w) x 9.02 (h) x 1.03 (d)

Read an Excerpt

The Server Object

In this short chapter we will move on to cover the Server object. The Server object is a low-level object that provides some basic properties and methods that can be used in almost every Active Server Page. This object will allow you to do things like:
  • Set the length of time for which a script can run before an error occurs
  • Take a user-supplied string and encode it into HTML format
  • Convert a virtual path to a physical path on the server
  • Take a user-supplied string and encode it into the proper format for a URL string
  • Create an instance of an Active Server component
The interface of the Server object looks like this. These methods and properties don't directly affect the appearance of the page on the browser, but they do provide valuable support in creating Active Server Pages.

Server Object Properties

The Server object has only one property - the ScriptTimeout property, described below.

The ScriptTimeOut Property

The ScriptTimeout property specifies the maximum amount of time that a script can run before it is terminated. This will prevent bugs (such as infinite loops) from causing the server process to hang indefinitely. The ScriptTimeout property is a read/write property. Its default value is 90 seconds.

Server.ScriptTimeOut = intSeconds

[intTimeoutVal = ]Server.ScriptTimeOut

Server Object Methods

The CreateObject method is used to create an instance of an Active Server component.

objCompRef = Server.CreateObject(progID)

For example, we use the CreateObject method to create instances of the server components supplied by Microsoft along with ASP:

Set objBrowser = Server.CreateObject("MSWC.BrowserType")

Response.Write("Hello, " & objBrowser.Browser & " user!")

The progID in this example is MSWC.BrowserType. All objects that come as part of the Microsoft Internet Information Server have MSWC (MicroSoft Web Component) in the Vendor part of the progID.

The CreateObject method is also used to create instances of the ADO database access objects:

Set objConn = Server.CreateObject("ADODB.Connection")

objConn.Open "driver={SQL Server}; server=srv; uid=sa; pwd=; database=pubs"

We will look at ADO in more detail in Chapter 8.

Lastly, the CreateObject method is used to create instances of custom Active Server components. These are components that are acquired from a third party, or that you've developed yourself. In either case, the method for creating an instance of them is the same:

Set objCustomASC = Server.CreateObject("MyComponentName.MyClass")

objCustomASC.methodCall

Objects created with the Server.CreateObject method are visible only to the script that is on the page where the object was created. We call this the page scope. Page-scoped objects are automatically destroyed by the server when at the end of the current page (although destroying the object formally using Set objName = Nothing is a good habit - it's a safer way to ensure that the server's resources are released). As we described in Chapter 4, we use the Application and Session objects to store instances with global scope or with session scope.

The HTMLEncode Method

The HTMLEncode method applies HTML encoding to the string supplied as its parameter.

[strEncoded = ]Server.HTMLEncode(strText)

HTML Encoding ensures that the string supplied will appear in a web page in the exact format that it is stored. Why is this necessary? Suppose you're passing a string to the browser for display. If your string contains any character-strings that look like HTML tags, then the browser interprets them as HTML tags - for example, of your string contains the substring of < B > then the browser will display all subsequent text in bold.

This may be the effect that you are looking for; but if you are writing HTML documentation (or anything else that requires the tags themselves to be visible in HTML), then you have a problem. By HTML-encoding the string, the parts of the string that look like HTML will be converted such that they will appear properly in the page. In the case of the < B > tag, the HTML encoded version would look like <B>. You'll find an example that uses the HTMLEncode method towards the end of Chapter 6.

The MapPath Method

The MapPath method is used to provide file location information for use in our scripts. The MapPath method takes a virtual path and converts it to a physical path.

[strPhysPath = ]Server.MapPath(strPath)

If strPath starts with a forward slash (/) or with a backward slash (\), the MapPath method returns a path as if strPath is a full virtual path. If strPath doesn't start with a slash, the MapPath method returns a path relative to the directory of the script file being processed. The MapPath method is also seen in action in Chapter 6.

The URLEncode Method

The URLEncode method takes a string of information and converts it into URL-encoded form. This method is used mostly for converting URLs into acceptable characters for browsers (hence the name URLEncode). However, the method works for any string, which makes it a very useful function, especially when dealing with e-mail addresses.

[strEncodedString = ]Server.URLEncode(strURL)

Using the Server Object

The Server object is a utility object, and you'll be seeing it action throughout many of the examples in the book. In particular, you'll see a lot of the CreateObject method in the examples of Chapters 7 and 8; you'll find the MapPath method utilized in the FileSystemObject example of Chapter 6, and you'll see URLEncode and HTMLEncode in the TextStream example, also in Chapter 6.

Summary

In this short chapter we have discussed the remaining object from the Active Server Pages object model. The Server object is a utility object that provides methods which are necessary in many web pages:
  • A method to create instances of the server-side components
  • The ability to set a global script timeout value
  • Methods to encode strings based on HTML or URL formatting rules
  • A method to translate a virtual directory name to its physical path on the hard drive
In the next chapter we will look at the objects that are part of the Scripting Library. While not exclusively for the use of ASP developers, they provide a great deal of functionality to make developer's lives easier.
Read More Show Less

Customer Reviews

Average Rating 4
( 1 )
Rating Distribution

5 Star

(0)

4 Star

(1)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted December 8, 1999

    great reference book on ASP 2.0

    very useful for both beginners and developers of ASP in scripting aspects.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)