A quick and effective (and low cost) solution for maximizing your site's exposure using Classic ASP
Active Server Pages 3.0 (Classic ASP)
Level of difficulty:
With the increasing interest in XML Web Services platforms from the various major
vendors (i.e., Microsoft's .NET Framework, Sun's J2EE, IBM's WebSphere), many people
have expressed an interest in getting their content to be shared by site owners and
entities external to their organization. This ranges in function from the simple
co-branding marketing service all the way up to an advanced e-commerce app that
allows for the exchange of data between partners in a B2B relationship. And up
until this point, accessing data from resources not within the same Web or network
was extremely difficult to do...if not completely impossible.
While the demands are going to be great for advanced access to data through XML Web
services, not many companies have been so quick to migrate to the technology... but
this doesn't mean you can't pull off something similar with Classic ASP.
Working in the NeverNeverLand of high technology (Guam), especially in these tough
economic times, I represent the "low-budget-to-no-budget" class of devs. The company
I work for isn't directly involved in technology, and as such we've got very little
to spend on IT. So I came up with a solution that does work...but is a little more
scaled down than your normal SQL Server 2000 ==> BizTalk Server ==> 1,000-node server
farm ==> monster datacenter solution. What we're going to write emulates the concept
of the XML Web service, using Classic ASP.
Your most powerful asset - information
It's a very competitive advantage if you can offer your content to partners for use on
their own sites... and it serves you very well. Large, dominating sites such as
MSNBC.COM do this to stay ahead of the competition in the online news game by offering
their headlines and story abstracts to other sites. The end result is that the content
provider ultimately gets the traffic, which is a win for justifying traffic levels, which
leads to revenue gains. And smaller sites love to incorporate remote content on their
pages to stimulate traffic increases by way of association with larger entities. But
the added overhead due to additional database connections is an unwanted headache for
So, our "Web service" consists of a very simple script which works with the
This service never relies on external clients directly connecting to your database, so there isn't an additional overhead concern other than the made by you when running the script. This prevents your main site from being bogged down. That's the beauty of it – you can control how many times the script is invoked if you embedded the script in an administration page, which would be executed by a staffer in your organization. So you could literally have tens, hundreds, or thousands of clients using your service and the load would at be the same minimal level, because you're essentially only connecting to your database once.
document.writeln('<a target="_blank" href="http://www.yourdomainname.com/filename.asp?id=8675309"><b>Senators debate during session sale of GTA</b></a><br>');
document.writeln('The privatization of the Guam Telephone Authority is being touted as a top priority of the Gutierrez administration, as its sale is expected to bring some major</a><br>');
.....more content as needed.....
This has benefits for the client, in that:
The script also truncates a "description" field and appends "..." if the string is too long. This saves you from having to modify your table structure in an existing database.
The only assumption is that you will have a file sitting on your server with the path (you can edit this to match your own site's settings).
There is one concern you'll want to watch out for, however (I learned this the hard way),
in that single quotation marks " ' " in ASCII format represent a line break in
ugly and dysfunctional service. And with much database-driven content being generated by
forms - transmitting data in ASCII - this could run into problems. Fortunately, Unicode
characters don't have this problem. As a workaround, I employ VBScript's Replace function
to check for the existence of ASCII-type single-quotes, swapping each one with a Unicode
I had to type in the ASCII single quote character using NotePad, and the Unicode
single-quote character using MS Word.)
Get the word out – promoting your "Web service"
You can then promote the heck out of your new "Web service" by having
interested users insert the following into the HTML of their page(s):
<% @ Language=VBScript %>
<html><body><head><META NAME="ROBOTS" CONTENT="NOINDEX,NOFOLLOW"></head>
' Portable Content Generator Script
' Written by Jason Salas: email@example.com
' November 6, 2001
' This script connects to a data store, creates a new text file and saves
' it to the Web server. The headlines can then be referenced in the
' underlying HTML code of a remote client page, using the absolute path
' to your file, such as:
' <!-- START PORTABLE HEADLINES -->
' <table border="0" cellpadding="0" cellspacing="0" width="100%">
' <tr><td width="100%"><font face="Arial" size="2">
' <!-- END PORTABLE HEADLINES -->
' The only assumptions in this example are that you will have an ASP page
' feeding data with the following path:
' ...and that your database has a table ("Content") with the
' following fields:
' DB Fields: StoryID, Title, Teaser
' declare variables and connect to the data store
Dim objConn, objRS, FSO, Headlines
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open "SELECT TOP 10 StoryID, Title, Teaser FROM Content " _
& "ORDER BY StoryID DESC", objConn
Set FSO = CreateObject("Scripting.FileSystemObject")
' the default path for IIS, you may need to change as needed based on
' the setup of your Web server
Set Headlines = FSO.CreateTextFile("C:\inetpub\wwwroot\portablecontent.js", _
' write all the new headlines to a text file from the recordset
' (overwriting an existing file), and replace ASCII-type single
' quotes with UNICODE-style single quotes so the resultant
Headlines.Write("<!--" & vbcrlf)
Do While Not objRS.EOF
trimmed = Replace(Trim(Left(objRS("Teaser"),165)),"'","’",1,-1, _
' change this to reflect the path to your normal content files
Headlines.Write("document.writeln('<a target=""_blank"" " _
& "href=""http://www.yourdomainname.com/filename.asp?id=" _
& objRS("StoryID") & """><b>" & Replace(objRS("Title"),"'", _
"’",1,-1,vbTextCompare) & "</b></a><br>');")
Headlines.Write(vbcrlf & "document.writeln('")
' crop the description and add "... (more)" if the description
' string is longer than 165 characters.
' if not, then just write out the string
If Len(trimmed) < 165 Then
Position1 = InStr(trimmed," ")
Position2 = 2
While Position1 > 1
If Position2 > 1 Then
Position1 = Position1+1
Position2 = InStr(Position1, trimmed, " ")
Position2 = Position1
Position1 = 0
Position2 = Position2-1
trimmed = left(trimmed, Position2)
trimmed = trimmed & "... <a target=""_blank"" " _
& "href=""http://www.yourdomainname.com/filename.asp?id=" _
& objRS("StoryID") & """>(more)</a>"
' destroy any open object references and close open connections
Set Headlines = nothing
Set FSO = nothing
Set objRS = nothing
Set objConn = nothing
' display a confirmation message
Response.Write("The headlines have been updated!")
See the result of this script in action by
You could also modify the script to output only headline-type information as shown at right.
.NET Web Services allow for greater flexibility and choice
The only limitation is that with a system such as this, the client has very little say in what he/she can do with the resultant data (e.g., filtering for content, subscription-driven services, etc.). The client can modify formatting for presentation purposes, but that's about it. MSNBC has a very powerful portable product that it makes available to its affiliate stations across the U.S. wherein site managers can pick-and-choose which newsfeeds they wish to receive as MSNBC updates its site.
This is the big draw of XML Web services with the .NET Framework – the service provider exposes access to the data to the client, and the client decides what to do with it to best fit his situation.
But for now, this is just an example of one of the many things you can do to drive more traffic to your site by leveraging the single-most important asset you've got – information.
Have fun! :-D
About The Author
Jason Salas is Manager of the Web Development group for KUAM.COM, one of Guam's most popular Web sites. He also writes business and technology-oriented columns for KUAM.COM, and hosts the weekly segment "Tech Talk" on KUAM-TV, a whimsical look at what's new on the technical front and the Internet subculture. He has worked in the information technology industry for more than 11 years as a salesperson, marketing manager, developer, consultant, and author.
He is a graduate of Simon Sanchez High School, has a Bachelor's degree in Marketing from the University of Guam, a degree in Music Theory with Emphasis in Guitar from the Sutton Institute in Texas, and a Master's degree in Management of Applied Technologies from the University of Phoenix. He is also a Microsoft Certified Professional.