Beispiel #1
0
 public IIsSite AddSite(string Description, string Path, SiteBinding Binding)
 {
     return AddSite(Description, Path, new SiteBinding[] { Binding });
 }
Beispiel #2
0
        public IIsSite AddSite(string Description, string Path, SiteBinding[] Bindings)
        {
            try
            {

                Object[] ObjectsA = null;

                if (Bindings.Length > 0)
                {

                    ObjectsA = new Object[Bindings.Length];

                    for (Int32 wsbI = 0; wsbI <= Bindings.Length - 1; wsbI++)
                    {

                        ObjectsA[wsbI] = String.Format("{0}:{1}:{2}", Bindings[wsbI].IP, Bindings[wsbI].Port, Bindings[wsbI].HostHeader);

                    }
                }

                else
                {

                    ObjectsA = new Object[0];

                }

                //ObjectsA = new object[] { "Testing.com", new Object[]{":110:Testing.com"}, @"C:\Inetpub\abc\" };
                string SiteId = _ServiceEntry.Invoke("CreateNewSite", Description, ObjectsA, Path).ToString();

                DirectoryEntry ws = new DirectoryEntry(_ServiceEntry.Path + "\\" + SiteId);
                DirectoryEntry wr = new DirectoryEntry(ws.Path + "\\Root");

                return new IIsSite(ws, wr);
            }

            catch
            {

                return null;

            }
        }