« Previous Next »

Thread: Microsoft.Web.Administration namespace?

Last post 09-21-2008 11:37 PM by erikkl2000. 19 replies.

Average Rating Rate It (5)

RSS

Page 2 of 2 (20 items) < Previous 1 2

Sort Posts:

  • 06-17-2006, 1:13 PM In reply to

    Re: Microsoft.Web.Administration namespace?

    Are there any namespaces to play with microsoft dns server and smtp server just like microsoft.web.administration ?
  • 06-18-2006, 11:51 AM In reply to

    • RobertAllan
    • Not Ranked
    • Joined on 05-23-2006, 7:28 PM
    • Atlanta GA
    • Posts 4

    Re: Microsoft.Web.Administration namespace?

    I too would like to know this.

    I am looking at IIS7 and Vista/Longhorn from the perspective of a web hoster.

    I am impressed with the ability to programatically control webs and ftp sites and sql databases, but going forward, the ability to control dns, pop, smtp would make this a complete solution.

    I know this isnt the forum for these topics, but perhaps some of you top IIS guns have some insight you would like to share.

    Thanks
    Robert Allan

    Robert Allan
    .Net Engineer
  • 09-19-2008, 1:13 PM In reply to

    • erikkl2000
    • Top 150 Contributor
    • Joined on 06-05-2005, 1:55 AM
    • McKinney, TX.
    • Posts 40

    Re: Microsoft.Web.Administration namespace?

    I see no one addresses the question that you had about a Microsoft.DNS.Administration.

     Does anyone know when this may become available?

     

     Erik

    There’s my side and there’s your opinion
  • 09-21-2008, 9:58 PM In reply to

    Re: Microsoft.Web.Administration namespace?

    There is a System.Net.Dns class that exposes some features from DNS, but not necesarilly a lot of functionality.

    Could you share what operations your are looking to use from a DNS class.

    Thanks

  • 09-21-2008, 11:37 PM In reply to

    • erikkl2000
    • Top 150 Contributor
    • Joined on 06-05-2005, 1:55 AM
    • McKinney, TX.
    • Posts 40

    Re: Microsoft.Web.Administration namespace?

     I have a site that requires to check the existence of a node from with in a zone. If it does not exist then I create that node.

     This is for a site that allows logged in users create a sub name like ::  MyCompany.EriksNewSite.Com. This way it looks a little more personalized.

    ----------

    The service i wrote is fairly straight forward but getting the correct data back out of the stream from the response of a dns command is  a B**CH to say the least.

     Service:

    ----

        public class AFCCDnsManager : MarshalByRefObject, AFCCDns.IAFCCDnsManager
        {

            public AFCCDnsManager()
            {
            }
            /// <summary>
            /// Checks to see if a zone contains a particular node
            /// </summary>
            /// <param name="server">dns server ( use ip when possible )</param>
            /// <param name="zone">domain name that contains the node</param>
            /// <param name="node">the prefix node in question</param>
            /// <returns>true if has records</returns>
            public bool CheckIfDomainZoneNodeHasRecords(string server, string zone, string node)
            {
                //
                Process myProcess = null;
                ProcessStartInfo myProcessStartInfo = null;
                StreamReader myStreamReader = null;
                string cmdFailed = string.Empty;
                string dnsCmd = string.Empty;
                StringBuilder output = null;
                try
                {
                    cmdFailed = "DNS Server failed";
                    //string cmdCompleted = "command completed successfully";
                    //Command failed:  DNS_ERROR_NAME_DOES_NOT_EXIST     9714
                    //cmd     server         cmd         zone        node
                    //dnscmd afcc-inc-ns1 /enumrecords AFCCINC.COM handlers
                    dnsCmd = string.Format("dnscmd {0} /enumrecords {1} {2}", server, zone, node);
                    output = new StringBuilder();
                    myProcess = new Process();
                    myProcessStartInfo =
                      new ProcessStartInfo("cmd.exe");
                    myProcessStartInfo.UseShellExecute = false;
                    myProcessStartInfo.CreateNoWindow = true;
                    myProcessStartInfo.RedirectStandardOutput = true;
                    myProcessStartInfo.RedirectStandardInput = true;
                    myProcessStartInfo.Arguments = dnsCmd;
                    myProcess.StartInfo = myProcessStartInfo;
                    myProcess.Start();

                    myStreamReader = myProcess.StandardOutput;
                    do
                    {
                        output.Append(myStreamReader.ReadLine() + "\n");
                    } while (myStreamReader.Peek() >= 0);

                    myProcess.StandardInput.WriteLine(dnsCmd);
                    do
                    {
                        output.Append(myStreamReader.ReadLine());
                    } while (myStreamReader.Peek() >= 0);
                    myProcess.StandardInput.WriteLine("\n");
                    do
                    {
                        output.Append(myStreamReader.ReadLine());
                    } while (myStreamReader.Peek() >= 0);
                    myProcess.StandardInput.WriteLine("\n");
                    do
                    {
                        output.Append(myStreamReader.ReadLine());
                    } while (myStreamReader.Peek() >= 0);
                    myProcess.StandardInput.WriteLine("\n");
                    do
                    {
                        output.Append(myStreamReader.ReadLine());
                    } while (myStreamReader.Peek() >= 0);
                    do
                    {
                        output.Append(myStreamReader.ReadLine());
                    } while (myStreamReader.Peek() >= 0);

                    myStreamReader.Close();
                    myProcess.Close();

                    Console.WriteLine(output.ToString());
                   
                    if (output.ToString().ToLower().Contains(cmdFailed.ToLower()))
                        return false;//0
                    return true;
                }
                catch (Exception ex)
                {
                    System.Net.Mail.MailMessage mm = null;
                    SmtpClient smtp = null;
                  
                    mm =
                        new System.Net.Mail.MailMessage
                            (new System.Net.Mail.MailAddress("problems@afccDnsManager.com"),
                            new System.Net.Mail.MailAddress("support@xxxx.com"));
                    //
                    mm.Subject = "Problems with the AFCC Dns Manager Service";
                    mm.Body = "Message: " + Environment.NewLine + ex.Message + Environment.NewLine + Environment.NewLine;
                    mm.Body += "Source : " + Environment.NewLine + ex.Source;
                    smtp = new SmtpClient("smtp.afccinc.com");

                    smtp.Send(mm);

                    mm = null;
                    smtp = null;
                    //
                    return true;
                }
                finally
                {
                    myProcess = null;
                    myProcessStartInfo = null;
                    myStreamReader = null;
                    cmdFailed = string.Empty;
                    dnsCmd = string.Empty;
                    output = null;
                }
            }

     

    -----------

    From web app

    using System;
    namespace AFCCDns
    {
       public interface IAFCCDnsManager
        {
            bool CheckIfDomainZoneNodeHasRecords(string server, string zone, string node);
        }
    }

    ----------------\

      bool hasRecords = true;
                //select channel to communicate with server
                ChannelServices.RegisterChannel(new TcpClientChannel(), false);
                
                AFCCDns.IAFCCDnsManager remObject =
                     (AFCCDns.IAFCCDnsManager)RemotingServices.Connect
                     (typeof(AFCCDns.IAFCCDnsManager),
                     "tcp://111.11.29.111:8875/AFCCDnsQuerry");//111.11.29.111:8875

                if (remObject == null)
                    Console.WriteLine("cannot locate server");
                else
                {
                    hasRecords = remObject.CheckIfDomainZoneNodeHasRecords("111.11.29.111", "HomeBuildersBlog.Com", "MyCompanyName");
                    Console.WriteLine(hasRecords);
                }
                 
                return hasRecords;
            }

    I am needing to querry the DNS server for records.

    Basically if there is a way MS can give us a object that will have the same commands as the DNS command .exe then we are good. This is what we are in need of. BIG TIME!

     

    There’s my side and there’s your opinion
Page 2 of 2 (20 items) < Previous 1 2