Alternative ASPDNS DLL
 

Alternative ASPDNS DLL is a simple component that provides forward and reverse DNS Lookups under ASP. It is alternative because it works somewhat differently to its sister component, ASPDNS. The original ASPDNS seems to be quite popular. In the year that it has been released, it has received only positive reviews. It has also been deployed by at least one commercial ASP hosting service. And, remarkably no-one has written to me saying that it destroyed their server.

The original ASPDNS is a relatively lightweight component. It uses the Windows socket functions GetHostByAddr and GetHostByName. Both these functions are part of the standard wsock32 libraray that ships with Microsoft Windows. The component basically just wraps these API functions into a usable component. While this works without problems, sometimes one needs slightly more control over the DNS lookup process. For example, on a heavily congested network or in the case of transient network errors, the Microsoft DNS functions can take a substantial time to perform a DNS lookup. This is quite normal and no other Operating System can do any different. However, you as ASP programmer might want to at least have a say in how long a lookup is allowed to take. This is what the alternative ASPDNS does.

The Alternative DNS Component works by making a UDP request directly to a proper DNS Server. It also provides the programmer with the capability to say how much time the server should be given to perform the requested DNS resolution. This makes for better programming control, because you can decide that the DNS Request should rather fail if it takes longer than say 10 seconds, as opposed to your ASP page just appearing to have locked up or producing a nasty error message.

Finally, like its sister component, Alternative ASPDNS is a form of freeware that I term donationware. You can use it for free, but if you want to, you can make a donation.

 
Alternative ASPDNS Properties & Methods
 
Public Property DNSServer As VariantDNSServerRead/Write Property that is used to specify the DNS Server to use. Can either be a FQDN like apollo.is.co.za or an IP Address (preferred) like 196.4.160.2.
Public Function GetIPFromName(vFQDN) As StringGetIPFromName (vFQDN)Performs a forward DNS lookup on the name passed in the parameter vFQDN. The method returns a string that contains the IP Address(es) of the host, or a zero length string if an error occurred. The Error can be retrieved using the LastError property. In the case where the hostname has more than one A record, the returned string actually contains a list of IP Addresses separated with vbcrlf's.
Public Function GetNameFromIP(vIPAddr) As StringGetNameFromIP (vIPAddr)Performs a Reverse DNS lookup for the IP Address passed in the parameter vIPAddr. The method returns a string that contains the hostname associated with the IP Address, or a zero length string if an error occurred. The Error can be retrieved using the LastError property.
Public Property LastError As String (read-only)LastErrorRead-Only Property that provides a description of the last error encountered. In the case where the GetIPFormName or GetNameFromIP methods returned a zero length string (which means that the DNS request failed), this property can be used to ascertain why the failure occurred. It is a human readable text string.
Public Property TimeOut As LongTimeOutRead/Write Property that can be used to specify the time (in ms) to wait for a DNS Lookup to complete. Valid values are 1 to 65535
 
Sample ASP code for the component
 
<%
vIPAddr = "196.15.200.26"
vFQDN = "www.ibm.com"

Set X = Server.CreateObject("ASPDNSX.RealDNSLookup")
X.DNSServer = "196.25.1.1"
X.TimeOut = 10000
T = X.GetNameFromIP(vIPAddr)
If Len(T) = 0 Then	
  Response.Write "Reverse DNS Resolution Failed. Error identified as " & X.LastError & "<BR>"
Else
  Response.Write "The Address" & vIpAddr & "resolves to " & T & "<BR>"
End If

T = X.GetIPFromName(vFQDN)
If Len(T) = 0 Then	
  Response.Write "Forward DNS Resolution Failed. Error identified as " & X.LastError & "<BR>"
Else
  Response.Write "The Hostname" & vIpAddr & "resolves to ip address(es)" & Replace(T,vbcrlf,", ") & "<BR>"
End If

Set X = Nothing
%>
 
Downloads
 
Complete Installation (Zip file)1,481,319 bytes
ASPDNSX DLL Only (Requires that you already have VB6 SP5 runtimes and MSWINSCK.OCX V6 SP5 and know how to use regsvr32.exe)61,440 bytes
 
Revision History
 
April 2, 2001Initial Release V0.5.1
 
Build & Resource Information
 
Primary Build Tool Visual Basic 6.0 SP5
DNS Library The vbDNS Module by Jim Huff of of Edinborg Productions
Internet RFC's RFC1010, RFC1304, RFC1035 and RFC1183
 
Donationware
 

As every programmer knows, a fair amount of time goes into developing a product. Programmers are normally nice guys but are not the sharpest business people. As a result, we tend to give away things for free. DONATIONWARE is my idea of letting you make a contribution if you feel that you would like to. So, if you like the software and feel that it saved you time, you can make a US$10 contribution. Or you can just use it for free and feel bad about it ;). Either way, the software is the same. It still works and it is not crippled. You will not receive a new super version of the component when you register. The free and the registered versions are the same. You do not HAVE to buy it, but if you want to make a contribution, feel free to do so by clicking here or by clicking on the button below. Thanks ;)

Click here to make a donation via RegSoft.com
 
Disclaimer
 

This Component is provided as is and without any guarantees or promises. You use it entirely at your own risk. It was written with care and was not designed to do anything clandestine or trojan like. However, it cannot be assumed to be bug or error free. You also cannot hold me responsible if it crashes your machine, corrupts your registry, destroys your Micosoft Visual Studio 6.0 SP5 (which it was built with) or starts World War III. Since it's free, I do not guarantee performance, support or error-free operation.

 
Contact Information
 

This Webpage was written in a great hurry, so please don't judge the control on the appearance of this page. One day when I grow up, I'll make a decent page. If you wish to mail me any comments, feel free to do so at stefan@internext.co.za

 
accesses since 2 April 2001