COM Component: AspDNS:Using AspDNS on your Website

About AspDNS

AspDNS is an Alentus-supported COM component than can perform forward and reverse DNS lookups returning either the IP address or the host name.

How to Use AspDNS

AspDNS provides the following methods to the ASP programmer:

  1. DNSLookup(hostname - string)

    e.g. DNSLookup("mailhost.anyhost.com")

    The return value is a string with the IP address of the hostname. Failure is indicated by an empty string.

  2. ReverseDNSLookup(IPAddress - string)

    e.g. ReverseDNSLookup ("255.255.255.0")

    If the IP address is found in the DNS the return value is the hostname.

AspDNS Example Code

1. Performing a DSN Lookup

<%
Dim DNSLook
Set DNSLook = Server.CreateObject("AspDNS.Lookup")
strHostName = "www.alentus.com"
Response.Write ("The IP Address of " & strHostName & " is " _
& DNSLook.DNSLookup(strHostName)
set DNSLook = nothing
%>

2. Performing a Reverse DSN Lookup

<%
Dim DNSLook
Set DNSLook = Server.CreateObject("AspDNS.Lookup")
strIPAddr = "66.46.105.8"
Response.Write ("The Host Name of " & strIPAddr & " is " _
& DNSLook.ReverseDNSLookup(strIPAddr)
%>

 

AspDNS Properties

Property

Description

Error

The error property is a read-only property used to report lookup errors.

Example:

Response.Write "Error: " & DNSLook.Error

Expires

Returns the expiration date of the component if the component is an evaluation copy.

Example:

Response.Write "Component Expires: " & DNSLook.Expires

RegisteredTo

If the component has been purchased the RegisteredTo property will return the licensee's name.

Example:

Response.Write "Component Licensee: " & DNSLook.RegisteredTo

TimeOut

The maximum time the DNS component will wait for an answer from the DNS server.

Example:

DNSLook.TimeOut = 45

Version

Gets the internal component version number.

Example:

Response.Write "Component Version: " & DNSLook.Version

AspDNS Component Methods

 

Method

Parameters

Return Value

Description

DNSLookup

strHostName

String

DNSLookup does a normal DNS lookup on strHostName. The return value, if successful, is the IP address for strHostName.

strRes =DNSLook.DNSLookup("www.serverobjects.com")

ReverseDNSLookup

strIPAddr

String

ReverseDNSLookup does a reverse DNS lookup on strIPAddr. The return value, if successful, is the host name for strIPAddr.

strRes =DNSLook.ReverseDNSLookup("199.1.195.11")

Add Feedback