• Del site


      string SiteID = null;
                DirectoryEntry root = new DirectoryEntry("IIS://localhost/W3SVC");
               
                    foreach (DirectoryEntry child in root.Children)
                    {
                        if (child.SchemaClassName == "IIsWebServer")
                        {
                            if (WebSiteName == child.Properties["servercomment"].Value.ToString())
                            {
                                 SiteID = child.Name.ToString();
                            }
                        }
                    }          
                try
                {
                    if (SiteID == null) return "error:该站点不存在.";

                    DirectoryEntry deRoot = new DirectoryEntry("IIS://localhost/W3SVC");
                    try
                    {
                        DirectoryEntry deVDir = new DirectoryEntry();
                        deRoot.RefreshCache();
                        deVDir = deRoot.Children.Find(SiteID, "IIsWebServer");
                        deRoot.Children.Remove(deVDir);

                        deRoot.CommitChanges();
                        deRoot.Close();
                        return "successful:删除站点" + WebSiteName + "成功!";
                    }
                    catch (System.Exception)
                    {
                        return "error:该站点不存在.";
                    }
                }
                catch (Exception e)
                {
                    return "error:删除站点失败." + e.Message;
                }

  • 相关阅读:
    新文章new图标
    3.6SiteFactory专业版,顶部导航的最后一个栏目向下移位的解决办法
    http://goodboy5264.blog.163.com/
    提升你网站水平的 jQuery 插件推荐
    如何把导航条做成sitefactory政府版的样子实现动态读取子栏目显示
    好的链接
    2011年度最佳jQuery插件
    asp中日期时间函数介绍
    若干设计模式学习
    多线程学习
  • 原文地址:https://www.cnblogs.com/greencolor/p/1792701.html
Copyright © 2020-2023  润新知