ASP To HTML Component

The ASP To HTML (ASP2HTM) component is a very thin layer over Java’s URL and URLConnection (in Java’s java.net package) classes. The component can be very useful in gaining much of the power of Active Server Pages, without the performance cost. Given a URL, the ASP2HTM object will connect to the location and retrieve its properties, exposing the properties to the owner/client of the ASP2HTM object. The document at the given URL can also be saved to a local file.

A typical use of this would be to download ASP pages from your own server, let the server-side scripting occur, and save the resulting HTML files. The HTML files can then be published on your Web site.

Note This component is not officially supported by Microsoft®. Peer support is available on the Active Server Pages mailing list or on the microsoft.public.inetserver.iis.activeserverpages newsgroup.

To subscribe to the Active Server Pages mailing list, send mail to listserv@listserv.msn.com with

subscribe ActiveServerPages [firstname lastname]

in the body of the message, and then follow the directions. (firstname and lastname are optional.)

You can reach the newsgroup through msnews.microsoft.com and other NNTP servers.

The following files are used by the ASP2HTM component:

FileNames
Asp2Htm.class Java class file.
asp2htm.vbs Sample VBScript file.

Syntax

<% Set oVar = Server.CreateObject("IISSample.Asp2Htm") %>

Example

The following example downloads the default IIS welcome page from your local server and translates it to an HTML page. The page is placed in the C:\Temp directory.

Set HTTP = CreateObject("IISSample.Asp2Htm")
HTTP.URL( "http://localhost/default.asp" )
if HTTP.GetData() then
	HTTP.WriteToFile( "c:\temp\temp.htm" )
end if
 

Methods

URL Sets the URL to connect to.
Title Retrieve the title of the HTML document.
Body Retrieve the body of the HTML document.
File Retrieve the name of the file at the given URL.
Host Retrieve the Host of the URL.
Port Retrieve the port number of the URL.
Protocol Retrieve the protocol of the given URL.
Ref Retrieve the anchor of the given URL.
ContentEncoding Retrieve the content-encoding header field of the document.
ContentLength Get the length of the content in the document.
ContentType Get the type of content in the document.
Date Get the sending date of the URL.
Expiration Get the expiration date of the document.
LastModified Get the last date of modification for the document.
Server Get the server name from the document.
GetData Retrieve the necessary data about the URL.
WriteToFile Write the retrieved document to the given file.