G
Guest
I need to change dynamically some DNS registers of our domain.
I figured that a WS would do the job so I developed a WS that has only one web method that receives an ID and an IP address from it clients. It verifies the ID and then proceeds to change the DNS pointer with the “dnscmd.exe†utility on a Win2000 server.
<WebMethod()> Public Function Nueva(ByVal quienSoy As String, ByVal miIP As String) As String
Dim miPInfo As ProcessStartInfo
Dim miProc As Process
Dim regreso As String
miPInfo = New ProcessStartInfo
With miPInfo
.FileName = "C:\WinNT\System32\dnscmd.exe"
.Arguments = ". /RecordDelete diato.com.mx " & quienSoy & " A /f"
.RedirectStandardOutput = True
.UseShellExecute = False
End With
miProc = Process.Start(miPInfo)
miProc.WaitForExit()
regreso = miProc.StandardOutput.ReadToEnd
Return regreso
End Function
When I run these method I get a “Command failed: ERROR_ACCESS_DENIED 5 (00000005)†as the return string (StandardOut of the process)
I went a added a user in this machine and made it a member of the “administrators†group.
I used the ASPNET_Setreg utility to encrypt the user name and password in the registry.
I added these lines in the Web.Confg file :
<identity impersonate="true"
userName="registry:HKLM\SOFTWARE\MyApp\MyId\ASPNET_SETREG,userName"
password="registry:HKLM\SOFTWARE\ MyApp\MyId\ASPNET_SETREG,password" />
I restarted the system and I get the same error message.
What am I doing wrong?
What else do I need to do?
Is there a smarter way to change DNS registers?
(Of course, if I run the dnscmd utility from the CMD box it runs ok)
Thanks,
Luis
I figured that a WS would do the job so I developed a WS that has only one web method that receives an ID and an IP address from it clients. It verifies the ID and then proceeds to change the DNS pointer with the “dnscmd.exe†utility on a Win2000 server.
<WebMethod()> Public Function Nueva(ByVal quienSoy As String, ByVal miIP As String) As String
Dim miPInfo As ProcessStartInfo
Dim miProc As Process
Dim regreso As String
miPInfo = New ProcessStartInfo
With miPInfo
.FileName = "C:\WinNT\System32\dnscmd.exe"
.Arguments = ". /RecordDelete diato.com.mx " & quienSoy & " A /f"
.RedirectStandardOutput = True
.UseShellExecute = False
End With
miProc = Process.Start(miPInfo)
miProc.WaitForExit()
regreso = miProc.StandardOutput.ReadToEnd
Return regreso
End Function
When I run these method I get a “Command failed: ERROR_ACCESS_DENIED 5 (00000005)†as the return string (StandardOut of the process)
I went a added a user in this machine and made it a member of the “administrators†group.
I used the ASPNET_Setreg utility to encrypt the user name and password in the registry.
I added these lines in the Web.Confg file :
<identity impersonate="true"
userName="registry:HKLM\SOFTWARE\MyApp\MyId\ASPNET_SETREG,userName"
password="registry:HKLM\SOFTWARE\ MyApp\MyId\ASPNET_SETREG,password" />
I restarted the system and I get the same error message.
What am I doing wrong?
What else do I need to do?
Is there a smarter way to change DNS registers?
(Of course, if I run the dnscmd utility from the CMD box it runs ok)
Thanks,
Luis