From: G.S.Aielli <giu...@ai...> - 2002-01-30 17:11:27
|
The easiest way to troubleshoot ASPDNS is using some development environment which supports Intellisense (and COM). So I strongly suggest to test ASPDNS under Visual Basic, then you can easily "port" to ASP. (If you don't have a VB license there is a Working model edition which is free, or you can use Office.) First add a reference to the COM object ASPDNS, then you have the chance to see the parameters list and the list of members ASPDNS exposes, more precisely than the help itself. I wrote the help file accurately but it for sure contains many mistakes. And, above all, you can make tests! Use our test code (there are most of possibilities): Option Explicit Private Sub cmdTest1_Click() Dim AllZones As New Zones, SomeRec As New RRecords, vZoneItm, vRecItm, vNZ As Zone Stop 'I suggest to look in the DNS MMC for real action to be performed SomeRec.Add "www", azRRTypeA, "192.168.0.1" SomeRec.Add "mail", azRRTypeMX, "192.168.0.2 0" Set vNZ = AllZones.Add("acme.com.mx", azZoneTypePrimary, azZoneStatusRunning, _ "ns.acme.com", "ns1.acme.com", "ns2.acme.com", , , , , , SomeRec) If vNZ Is Nothing Then MsgBox "Created an object set to Nothing (vNZ is invalid)." Else 'vNZ is a valid Zone object, representing the newly created zone Debug.Print vNZ.RRecords.Count Debug.Print vNZ.RRecords("www") End If For Each vZoneItm In AllZones 'printing all zones Debug.Print vZoneItm; vZoneItm.ZoneStatus For Each vRecItm In vZoneItm.RRecords 'printing all records in every zone Debug.Print vbTab & vRecItm Next vRecItm Next vZoneItm 'printing some values Debug.Print AllZones("acme.com.mx").Expire Debug.Print AllZones("acme.com.mx").RRecords("www").RRType Debug.Print AllZones("acme.com.mx").RRecords("mail").RRData MsgBox "Press Ok to remove all the mess I have done." AllZones.Remove "acme.com.mx" MsgBox "Finished testing." End Sub Private Sub cmdTest2_Click() Dim oManager As New ManageServer, vRet Stop 'I suggest to look in the DNS MMC for real action to be performed oManager.AddPrimaryZone "acme.com", "ns.acme.com", "ns1.acme.com", "ns2.acme.com", , vRet Debug.Print vRet oManager.SetSOA "acme.com", "ns.nic.it", , 200200101, , , , , , vRet Debug.Print vRet Dim vItm, oZones Set oZones = oManager.GetZones() For Each vItm In oZones Debug.Print vbTab & vItm Next vItm Debug.Print oManager.AddHost "acme.com", "pop", "12.12.12.12", , vRet Debug.Print vRet oManager.AddAlias "acme.com", "www", "pop", , vRet Debug.Print vRet oManager.AddMailer "acme.com", "mail", 0, "192.168.0.1", , vRet Debug.Print vRet oManager.AddNameServer "acme.com", "ns1", , vRet Debug.Print vRet oManager.AddNameServer "acme.com", "ns2", , vRet Debug.Print vRet oManager.AddRecord "acme.com", "@ NS ns3", , vRet Debug.Print vRet Dim oRecs Set oRecs = oManager.ZoneEnumRecords("acme.com", , vRet) For Each vItm In oRecs Debug.Print vItm Next vItm Debug.Print Debug.Print oManager.ViewZone("acme.com", ".") MsgBox "Press Ok to remove all the mess I have done." oManager.DeleteAlias "acme.com", "www", , vRet Debug.Print vRet oManager.DeleteHost "acme.com", "pop", "12.12.12.12", , vRet Debug.Print vRet oManager.DeleteMailer "acme.com", "mail", 0, "192.168.0.1", , vRet Debug.Print vRet oManager.DeleteNameServer "acme.com", "ns2.acme.com", , vRet Debug.Print vRet oManager.DeleteRecord "acme.com", "@ NS ns3", , vRet Debug.Print vRet oManager.DeleteZone "acme.com", , vRet Debug.Print vRet oManager.GetDnsInfo , vRet Debug.Print vRet oManager.AddSecondaryZone "acme.com", "192.168.0.1", , vRet Debug.Print vRet oManager.DeleteZone "acme.com", , vRet Debug.Print vRet MsgBox "Finished testing." End Sub Private Sub cmdTest3_Click() Dim AllZones As New Zones, SomeRec As New RRecords, vZoneItm, vRecItm, vNZ As Zone Stop 'I suggest to look in the DNS MMC for real action to be performed AllZones.Add "acme.com", azZoneTypePrimary, azZoneStatusRunning, "ns.acme.com", "ns1.acme.com", "ns2.acme.com" AllZones("acme.com").Expire = 1000 AllZones("acme.com").MinTTL = 1000 AllZones("acme.com").NS1 = "ns1.acme.net" AllZones("acme.com").NS2 = "ns2.acme.net" AllZones("acme.com").PrimaryServer = "ns.acme.net" AllZones("acme.com").Refresh = 1000 AllZones("acme.com").ResponsiblePerson = "gsaielli" AllZones("acme.com").Retry = 1000 AllZones("acme.com").Serial = 1000 AllZones("acme.com").RRecords.Add "mail", azRRTypeMX, "10.0.0.0 7" AllZones("acme.com").RRecords("mail").RRData = "12.12.12.12 0" AllZones("acme.com").RRecords("mail").RRName = "mailer" AllZones("acme.com").RRecords.Add "www", azRRTypeA, "192.168.1.1" AllZones("acme.com").RRecords("www").RRData = "192.168.1.2" AllZones("acme.com").RRecords("www").RRName = "www2" AllZones("acme.com").RRecords.Add "err", azRRTypeCNAME, "error" AllZones("acme.com").RRecords("err").RRData = "www2" AllZones("acme.com").RRecords("err").RRName = "www" AllZones("acme.com").ZoneStatus = azZoneStatusPaused MsgBox "Press Ok to remove all the mess I have done." AllZones.Remove "acme.com" MsgBox "Finished testing." End Sub Private Sub cmdTest4_Click() 'managing an heavy number of zones Dim AllZones As New Zones, SomeRec As New RRecords, vZoneItm, vRecItm, vNZ As Zone, i As Integer Stop 'I suggest to look in the DNS MMC for real action to be performed 'add 100 zones with 2 records each SomeRec.Add "www", azRRTypeA, "192.168.0.1" SomeRec.Add "mail", azRRTypeMX, "192.168.0.2 0" For i = 1 To 5000 AllZones.Add "acme" & Format(i, "000#") & ".com", azZoneTypePrimary, azZoneStatusRunning, _ "ns.acme.com", "ns1.acme.com", "ns2.acme.com", , , , , , SomeRec Next For Each vZoneItm In AllZones 'printing all zones Debug.Print vZoneItm; vZoneItm.ZoneStatus 'For Each vRecItm In vZoneItm.RRecords 'printing all records in every zone ' Debug.Print vbTab & vRecItm 'Next vRecItm Next vZoneItm MsgBox "Press Ok to remove all the mess I have done." Do While AllZones.Count > 0 AllZones.Remove 1 Loop MsgBox "Finished testing." End Sub Private Sub cmdTest5_Click() Dim AllZones As New Zones, SomeRec As New RRecords, vZoneItm, vRecItm, vNZ As Zone, i As Integer Stop Debug.Print AllZones("acme.com.mx").RRecords("sub.www") End Sub Private Sub Form_Click() Dim oDNS, vRes Set oDNS = CreateObject("ASPDNS.ManageServer") oDNS.GetDnsInfo ".", vRes MsgBox vRes End Sub ----- Original Message ----- From: "Michael Olsen" <Mic...@it...> To: <asp...@li...> Sent: Wednesday, January 30, 2002 5:52 PM Subject: Re: [Aspdns-users] ASP Pages with MX & NS Records Hi Gsa I have checked the ViewZone and there you can't get the NS og MX records. ManageServer.getSOA How does it work? Zone.NS1 & NS2 can't I get to work. In the eventlog there is an error regarding ZoneEnumsrecords. Whenn is the next release? Thanks Michael _______________________________________________ Aspdns-users mailing list Asp...@li... https://lists.sourceforge.net/lists/listinfo/aspdns-users |