zoukankan      html  css  js  c++  java
  • [转]《当老温遭遇C#》之虚拟主机管理系统

    这东西我早晚会用到的,怕丢了,先转载!

    《当老温遭遇C#》之虚拟主机管理系统 【附核心实现源码】【另可提供中国各大域名服务端接口】[收藏]

    老温点评:上次发布了探针后,我决定把相关的知识也理一下,方便于大家,这个是我四年前的作品,练手作,也花了我很多时间,所以代码比较凌乱!现大网上大多数实现虚拟主机管理系统的都是基于ASP+COM或PHP+COM,而且都是收费,看着想改个地方都被约束着,本文凭借C#之光辉打造强大的虚拟主机平台。将实现FTP,IIS,SQL等动态管理,包括在线解压缩的实现等!您可以利用本文涉及到的知识进行多用户域名绑定,多用户在线提供内容服务,对于博客可以实现独立国际域名绑定服务等等

    直奔主题:下面几个是核心的几大类码,我就不讲了,一看就懂!我这儿有必要讲一下架构的方式:一客户端(前台网站)+后台服务端(网站)+多被控端(提供服务的机子,如FTP服务器,IIS服务器) 因为你的业务达到上万人的时候必须要用这种架构方式,分离提供服务的服务器!UI和用户逻辑这些都是和平常网站管理一样的,最主要的是提供服务类的公用类库,如下,您可以加以改进!另外域名服务中国主要分为四大家,需要加钱入代理商才能提供域名编程接口,因为涉及到商业秘密,我这儿无法直接提供下载,您有需要可以与我联系,QQ:99748954 MSN:wenzhoufeng@hotmail.com

    系统平台:2003+IIS+SER-U+WINMAIL+MSSQL

    关于IIS的合法安全独立配置会涉及到应用程序池以及WINDOWS安全设置,本文也正是以这个为出发点,动态对WINDOWS帐户进行动态分配与权限设置,您可以详见WINDOWS2003终极安全配置方案,这样一个站点挂掉不会影响其它站点,一个站点对应不同的帐户,您可以将ASP服务的用一个WIN帐户进行绑定10-20个IIS站点,ASPNET站点我推荐1帐户1站点模式.

    对于域名的接口服务,无法就是你冲钱加盟代理,然后他给你帐户编程接口,利用该合法帐户进行域名查询,域名续费,域名过户等动态编程接口

    另外一位本人的好友曾经使用我这些资料已经成功开发并运营虚拟主机商服务,已经运营快近一年时间,这个利润还是可以的.我呢也就拿它一包中华抽抽嘻嘻

    using System;
    using System.DirectoryServices;
    using System.Collections;
    using System.Text.RegularExpressions;
    using System.Text;
    using System.Reflection;
    using System.IO;
    using System.Security.AccessControl;
    using Microsoft.Win32;
    using System.Diagnostics;
    namespace DvCMS.vHost.client
    {
        public class IISAdminLib
        {
            #region UserName,Password,HostName的定义

            public static string HostName
            {
                get
                {
                    return hostName;
                }
                set
                {
                    hostName = value;
                }
            }

            public static string UserName
            {
                get
                {
                    return userName;
                }
                set
                {
                    userName = value;
                }
            }

            public static string Password
            {
                get
                {
                    return password;
                }
                set
                {
                    if (UserName.Length <= 1)
                    {
                        throw new ArgumentException("还没有指定好用户名。请先指定用户名");
                    }
                    password = value;
                }
            }

            public static void RemoteConfig(string hostName, string userName, string password)
            {
                HostName = hostName;
                UserName = userName;
                Password = password;
            }

            private static string hostName = "localhost";
            private static string userName;
            private static string password;
            #endregion

            public static void AddFileSecurity(string Account,string path)
            {

                DirectoryInfo di = new DirectoryInfo(path);
                DirectorySecurity ds = di.GetAccessControl();
                FileSystemAccessRule ar1 = new FileSystemAccessRule(Account, FileSystemRights.FullControl, AccessControlType.Allow);
                FileSystemAccessRule ar2 = new FileSystemAccessRule(Account, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit | InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow);
                ds.AddAccessRule(ar1);
                ds.AddAccessRule(ar2);
                di.SetAccessControl(ds);
            }

            public static void RemoveFileSecurity(string Account, string pathname)
            {
                DirectoryInfo dirinfo = new DirectoryInfo(pathname);

                if ((dirinfo.Attributes & FileAttributes.ReadOnly) != 0)
                {
                    dirinfo.Attributes = FileAttributes.Normal;
                }

                //取得访问控制列表
                DirectorySecurity dirsecurity = dirinfo.GetAccessControl();
                dirsecurity.RemoveAccessRuleAll(new FileSystemAccessRule(Account, FileSystemRights.FullControl, AccessControlType.Allow));
                dirinfo.SetAccessControl(dirsecurity);

            }

            //修改NT用户密码
            //传入参数:Username用户名,Userpassword用户新密码
            public static bool InitNTPwd(string Username, string Userpassword)
            {
                try
                {
                    DirectoryEntry obComputer = new DirectoryEntry("WinNt://" + Environment.MachineName);
                    DirectoryEntry obUser = obComputer.Children.Find(Username, "webaccount");
                    obUser.Invoke("SetPassword", Userpassword);
                    obUser.CommitChanges();
                    obUser.Close();
                    obComputer.Close();
                    return true;
                }
                catch
                {
                    return false;
                }
            }

            //删除NT用户
            //传入参数:Username用户名
            public static bool DelNTUser(string strNodeName)
            {
                DirectoryEntry User;
                DirectoryEntry AD=null;
                try
                {
                    AD = new DirectoryEntry("WinNT://" + Environment.MachineName + ",computer");
                    User = AD.Children.Find(strNodeName, "User");
                    AD.Children.Remove(User);
                    return true;
                }
                catch
                {
                    return false;
                }
                finally
                {
                    AD.Dispose();
                }
            }

            /// <summary>
            /// 获取主机头
            /// </summary>
            /// <param name="siteName"></param>
            /// <returns></returns>
            public static string[] GetHeadhost(string siteName)
            {
                ArrayList list = new ArrayList();
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                PropertyValueCollection Thostnames = siteEntry.Properties["ServerBindings"];
                for (int i = 0; i < Thostnames.Count; i++)
                {
                                   list.Add(Thostnames[i].ToString());
                }
                if (list.Count == 0)
                    return new string[0];
                else
                    return (string[])list.ToArray(typeof(string));
            }

            public static void CleareHosthead(string siteName)
            {
                 string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                PropertyValueCollection   Thostnames   =  siteEntry.Properties["ServerBindings"];
                Thostnames.Clear();
                siteEntry.CommitChanges();
            }

            public static string RestartIIS()
            {
                string retstr = string.Empty;
                try
                {

                    Process.Start("iisreset","stop");
                }
                catch (Exception ex)
                {
                    retstr = ex.Message;
                }
               return retstr;
            }

            /// <summary>
            /// 配置主机头
            /// </summary>
            /// <param name="headhost"></param>
            /// <returns></returns>
            public static void ConfigHeadhost(string siteName, string headhost)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                PropertyValueCollection   Thostnames   =  siteEntry.Properties["ServerBindings"];
                Thostnames.Add(headhost);
                siteEntry.CommitChanges();
            }

            //创建NT用户
            //传入参数:Username要创建的用户名,Userpassword用户密码,Path主文件夹路径
            public static bool CreateNTUser(string Username, string Userpassword, string Path)
            {
                DirectoryEntry obDirEntry = null;
                try
                {
                    obDirEntry = new DirectoryEntry("WinNT://" + Environment.MachineName);
                    DirectoryEntry obUser = obDirEntry.Children.Add(Username, "User"); //增加用户名
                    obUser.Properties["FullName"].Add(Username); //用户全称
                    obUser.Invoke("SetPassword", Userpassword); //用户密码
                    obUser.Invoke("Put", "Description", "站点相对应的帐号");//用户详细描述
                    //obUser.Invoke("Put","PasswordExpired",1); //用户下次登录需更改密码
                    obUser.Invoke("Put", "UserFlags", 66049); //密码永不过期
                    //obUser.Invoke("Put", "UserFlags", 0x0040);//用户不能更改密码s
                    obUser.CommitChanges();//保存用户
                    DirectoryEntry grp = obDirEntry.Children.Find("webaccount", "group");//Users组
                    if (grp.Name != "")
                    {
                        grp.Invoke("Add", obUser.Path.ToString());//将用户添加到某组
                    }
                    return true;
                }
                catch
                {
                    return false;
                }
            }

            //创建IIS_wpg进程用户
            //传入参数:Username要创建的用户名,Userpassword用户密码,Path主文件夹路径
            public static bool CreateAppUser(string Username, string Userpassword, string Path)
            {
                DirectoryEntry obDirEntry = null;
                try
                {
                    obDirEntry = new DirectoryEntry("WinNT://" + Environment.MachineName);
                    DirectoryEntry obUser = obDirEntry.Children.Add(Username, "User"); //增加用户名
                    obUser.Properties["FullName"].Add(Username); //用户全称
                    obUser.Invoke("SetPassword", Userpassword); //用户密码
                    obUser.Invoke("Put", "Description", "站点相对应的帐号");//用户详细描述
                    //obUser.Invoke("Put","PasswordExpired",1); //用户下次登录需更改密码
                    obUser.Invoke("Put", "UserFlags", 66049); //密码永不过期
                    //obUser.Invoke("Put", "UserFlags", 0x0040);//用户不能更改密码s
                    obUser.CommitChanges();//保存用户
                    DirectoryEntry grp = obDirEntry.Children.Find("IIS_WPG", "group");//Users组
                    if (grp.Name != "")
                    {
                        grp.Invoke("Add", obUser.Path.ToString());//将用户添加到某组
                    }
                    return true;
                }
                catch
                {
                    return false;
                }
            }

            /// <summary>
            /// 删除应用程序池
            /// </summary>
            /// <returns></returns>
            public static void DeleteAppPoolByName(string AppPoolName)
            {

                try
                {
                    DirectoryEntry IISEntryPool = new DirectoryEntry("IIS://localhost/w3svc/AppPools");
                    foreach (DirectoryEntry de in IISEntryPool.Children)
                    {
                        if (String.Compare(de.Name, AppPoolName, true) == 0)
                        {
                            IISEntryPool.Children.Remove(de);
                            IISEntryPool.CommitChanges();
                        }
                    }
                }
                catch (Exception ex)
                {
                    //错误处理过程
                }
            }

            /// <summary>
            /// method是管理应用程序池的方法,有三种Start、Stop、Recycle,而AppPoolName是应用程序池名称
            /// </summary>
            /// <param name="method"></param>
            /// <param name="AppPoolName"></param>
            public static void ConfigAppPool(string method, string AppPoolName)
            {
                DirectoryEntry appPool = new DirectoryEntry("IIS://localhost/W3SVC/AppPools");
                DirectoryEntry findPool = appPool.Children.Find(AppPoolName, "IIsApplicationPool");
                findPool.Invoke(method, null);
                appPool.CommitChanges();
                appPool.Close();
            }
            /// <summary>
            /// 创建一个新的应用程序池
            /// </summary>
            /// <param name="AppPoolName"></param>
            public static void CreateAppPool(string AppPoolName,string WAMUserName,string WAMUserPass)
            {
                DirectoryEntry newpool;
                DirectoryEntry apppools = new DirectoryEntry("IIS://localhost/W3SVC/AppPools");
                newpool = apppools.Children.Add(AppPoolName, "IIsApplicationPool");
                newpool.Properties["AppPoolIdentityType"][0] = 0x00000003;
                newpool.Properties["WAMUserName"][0] = WAMUserName;
                newpool.Properties["WAMUserPass"][0] = WAMUserPass;
                newpool.CommitChanges();
            }

            /**/
            /// <summary>
            /// 创建站点
            /// </summary>
            /// <param name="iisServer"></param>
            public static void CreateIISWebServer(NewWebSiteInfo siteInfo, string iisp, string iisc, string maxweight, bool ishtml, bool isaspnet, bool asp, bool php, int sessiontimeout)
            {
                if (siteInfo.CommentOfWebSite.ToString() == "")
                    throw (new Exception("IISWebServer的ServerComment不能为空!"));
                DirectoryEntry Service = new DirectoryEntry("IIS://" + Environment.MachineName + "/W3SVC");
                DirectoryEntry Server;
                int i = 0;
                IEnumerator ie = Service.Children.GetEnumerator();

                while (ie.MoveNext())
                {
                    Server = (DirectoryEntry)ie.Current;
                    if (Server.SchemaClassName == "IIsWebServer")
                    {
                        if (Convert.ToInt32(Server.Name) > i)
                            i = Convert.ToInt32(Server.Name);
                        //                    if( Server.Properties["Serverbindings"][0].ToString() == ":" + iisServer.Port + ":" )   
                        //                    {
                        //                        Server.Invoke("stop",new object[0]);
                        //                    }
                    }
                }
                i++;
                try
                {
                   // iisServer.index = i;
                    Server = Service.Children.Add(i.ToString(), "IIsWebServer");
                    Server.Properties["ServerComment"][0] = siteInfo.CommentOfWebSite;
                    Server.Properties["Serverbindings"].Add(siteInfo.BindString);
                    Server.Properties["AccessScript"][0] = false;
                    Server.Properties["AccessRead"][0] = true;
                    Server.Properties["EnableDirBrowsing"][0] = false;
                    Server.Properties["LogFileDirectory"].Value = siteInfo.WebPath.Replace("wwwroots", "Logfiles");
                    Server.Properties["MaxBandwidth"].Value = Convert.ToInt32(maxweight) * 1024;
                    Server.Properties["MaxConnections"].Value = Convert.ToInt32(iisc);
                    Server.Properties["DefaultDoc"][0] = "index.htm,Default.htm,index.asp,Default.asp,index.aspx,Default.aspx,index.php,default.php";
                    Server.Properties["EnableDefaultDoc"][0] = true;
                    Server.Properties["AspEnableParentPaths"].Value = true;
                    Server.Properties["AspRequestQueueMax"].Value = iisp;
                    Server.Properties["AspSessionTimeout"].Value = sessiontimeout;
                    Server.Properties["AppPoolId"].Value = siteInfo.CommentOfWebSite;
                    Server.Properties["AnonymousUserName"].Value = siteInfo.CommentOfWebSite;
                    Server.Properties["AnonymousUserPass"].Value = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(siteInfo.CommentOfWebSite + "wenweifeng", "md5");
                    if (php == false && asp == false && isaspnet == false)
                    {

                        Server.Properties["AccessScript"][0] = false;//纯脚本

                    }
                    else
                    {

                        Server.Properties["AccessScript"][0] = true;//纯脚本
                        //继续判断是否支持PHP,ASP,和ASP.Net
                        if (php & asp & isaspnet)
                        {
                            //三种都支持的情况下
                            Server.Properties["ScriptMaps"].Value = GetScriptRun(1);
                        }
                        else if (php & asp & (!isaspnet))
                        {
                            //只支持ASP与PHP的情况下
                            Server.Properties["ScriptMaps"].Value = GetScriptRun(4);
                        }
                        else if ((!php) & asp & isaspnet)
                        {
                            //只支持ASP与Asp.NET的情况下
                            Server.Properties["ScriptMaps"].Value = GetScriptRun(3);
                        }

                        else if ((!php) & asp & (!isaspnet))
                        {
                            //只支持ASP的情况下
                            Server.Properties["ScriptMaps"].Value = GetScriptRun(2);
                        }
                        else
                        {
                            //只支持ASP
                            Server.Properties["ScriptMaps"].Value = GetScriptRun(2);
                        }

                    }
                    DirectoryEntry root = Server.Children.Add("Root", "IIsWebVirtualDir");
                    root.Properties["path"][0] = siteInfo.WebPath;
                    //root.Properties["AppIsolated"].Value = 2;

                    Service.CommitChanges();
                    Server.CommitChanges();
                    root.CommitChanges();
                    root.Invoke("AppCreate2", new object[1] {2});
                    //Server.Invoke("start",new object[0]);
                }
                catch (Exception es)
                {
                    throw (es);
                }
            }

            #region 根据路径构造Entry的方法

            /// <summary>
            /// 根据是否有用户名来判断是否是远程服务器。
            /// 然后再构造出不同的DirectoryEntry出来
            /// </summary>
            /// <param name="entPath">DirectoryEntry的路径</param>
            /// <returns>返回的是DirectoryEntry实例</returns>

            public static DirectoryEntry GetDirectoryEntry(string entPath)
            {
                DirectoryEntry ent;
                if (UserName == null)
                {
                    ent = new DirectoryEntry(entPath);
                }
                else
                {
                    // ent = new DirectoryEntry(entPath, HostName+"\"+UserName, Password, AuthenticationTypes.Secure);
                    ent = new DirectoryEntry(entPath, UserName, Password, AuthenticationTypes.Secure);
                }
                return ent;
            }

            #endregion
            #region 添加,删除网站的方法

            /// <summary>
            /// 创建一个新的网站。根据传过来的信息进行配置
            /// </summary>
            /// <param name="siteInfo">存储的是新网站的信息</param>

            public static void CreateNewWebSite(NewWebSiteInfo siteInfo, string iisp, string iisc, string maxweight, bool ishtml, bool isaspnet, bool asp, bool php,int sessiontimeout)
            {
                if (!EnsureNewSiteEnavaible(siteInfo.BindString))
                {
                    //throw new DuplicatedWebSiteException("已经有了这样的网站了。" + Environment.NewLine + siteInfo.BindString);
                }
                else
                {
                    string entPath = String.Format("IIS://{0}/w3svc", HostName);
                    DirectoryEntry rootEntry = GetDirectoryEntry(entPath);
                    string newSiteNum = GetNewWebSiteID();
                    DirectoryEntry newSiteEntry = rootEntry.Children.Add(newSiteNum, "IIsWebServer");
                    newSiteEntry.CommitChanges();
                    newSiteEntry.Properties["ServerBindings"].Value = siteInfo.BindString;
                    newSiteEntry.Properties["ServerComment"][0] = siteInfo.CommentOfWebSite;
                    //应用程序部分
                    newSiteEntry.Properties["KeyType"].Value = "IIsWebServer";
                    //判断为HTML主机则将应用FALSE,判断依据为ASP,PHP,ASPNET都为False
                    newSiteEntry.Properties["AccessRead"][0] = true;//读
                    newSiteEntry.Properties["AccessExecute"][0] = false;
                    if (php == false && asp == false && isaspnet == false)
                    {

                        newSiteEntry.Properties["AccessScript"][0] = false;//纯脚本

                    }
                    else
                    {

                        newSiteEntry.Properties["AccessScript"][0] = true;//纯脚本
                        //继续判断是否支持PHP,ASP,和ASP.Net
                        if (php & asp & isaspnet)
                        {
                            //三种都支持的情况下
                            newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRunver2(1);
                        }
                        else if (php & asp & (!isaspnet))
                        {
                            //只支持ASP与PHP的情况下
                            newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRunver2(4);
                        }
                        else if ((!php) & asp & isaspnet)
                        {
                            //只支持ASP与Asp.NET的情况下
                            newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRunver2(3);
                        }

                        else if ((!php) & asp & (!isaspnet))
                        {
                            //只支持ASP的情况下
                            newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRunver2(2);
                        }
                        else
                        {
                            //只支持ASP
                            newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRunver2(2);
                        }

                    }
                   //newSiteEntry.Properties["AppIsolated"].Value = 2;
                    //站点的日志文件
                   newSiteEntry.Properties["LogFileDirectory"].Value = siteInfo.WebPath.Replace("wwwroots", "Logfiles");
                    //站点的最大带宽
                    newSiteEntry.Properties["MaxBandwidth"].Value = Convert.ToInt32(maxweight)*1024;
                    //站点的最大连接客户数
                   newSiteEntry.Properties["MaxConnections"].Value =Convert.ToInt32(iisc);
                    newSiteEntry.CommitChanges();
                    DirectoryEntry vdEntry = newSiteEntry.Children.Add("root", "IIsWebVirtualDir");
                   // vdEntry.Invoke("AppCreate2", 2);
                   vdEntry.Properties["AppRoot"].Value = "LM/W3SVC/" + newSiteNum + "/Root";
                   vdEntry.Properties["Path"][0] = siteInfo.WebPath;
                   vdEntry.Properties["EnableDefaultDoc"][0] = false;
                   vdEntry.Properties["AppFriendlyName"].Value = "默认应用程序";
                  vdEntry.Properties["AppPoolId"].Value = siteInfo.CommentOfWebSite;
                    vdEntry.Properties["AnonymousUserName"].Value = siteInfo.CommentOfWebSite;
                   vdEntry.Properties["AnonymousUserPass"].Value = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(siteInfo.CommentOfWebSite + "wenweifeng", "md5");
                   vdEntry.Properties["DefaultDoc"][0] = "index.htm,Default.htm,index.asp,Default.asp,index.aspx,Default.aspx,index.php,default.php";
                   //vdEntry.Properties["DefaultDocFooter"].Value = false;//有严重的问题导致数据无效
                  vdEntry.Properties["EnableDefaultDoc"][0] = true;
                  vdEntry.Properties["EnableDirBrowsing"][0] = false;//目录浏览
                  vdEntry.Properties["AccessWrite"][0] = false;//写入
                   // vdEntry.Properties["AppAllowClientDebug"].Value = true;
                    vdEntry.Properties["AspEnableParentPaths"].Value = true;
                   // vdEntry.Properties["AspAllowSessionState"].Value = true;
                      //ASP应用程序的Sessiontimeout会话时间
                    //vdEntry.Properties["AspSessionTimeout"].Value = sessiontimeout;
                    vdEntry.Properties["AspScriptLanguage"].Value = "VBScript";
                    //vdEntry.Properties["AspScriptTimeout"].Value = 90;
                    //  ASP最大查询并发数
                    vdEntry.Properties["AspRequestQueueMax"].Value = iisp;
                   // vdEntry.Properties["AspScriptErrorSentToBrowser"].Value = false;
                    //Type typ = vdEntry.Properties["IPSecurity"][0].GetType();
                    //object IPSecurity = vdEntry.Properties["IPSecurity"][0];
                    //object[] newIPDenyList = new object[4];
                    //newIPDenyList[0] = "192.168.1.1,   255.255.255.255";
                    //newIPDenyList[1] = "192.168.1.2,   255.255.255.255";
                    //newIPDenyList[2] = "192.168.1.3,   255.255.255.255";
                    //newIPDenyList[3] = "192.168.1.4,   255.255.255.255";

                    //typ.InvokeMember("IPDeny",
                    //                               BindingFlags.DeclaredOnly |
                    //                               BindingFlags.Public | BindingFlags.NonPublic |
                    //                               BindingFlags.Instance | BindingFlags.SetProperty,
                    //                               null, IPSecurity, new object[] { newIPDenyList });

                    //vdEntry.Properties["IPSecurity"][0] = IPSecurity;
                   vdEntry.Invoke("AppCreate2", new object[1] { 2 });
                    vdEntry.CommitChanges();
                    rootEntry.CommitChanges();
                }
            }

            public static string[] GetScriptRunver2(int i)
            {
                string[] _script1;
                string[] _script2;
                string[] _script3;
                string[] _script4;
                string[] ret;
                //支持 asp/asp.net/php
                _script1 = new string[27]{".asa,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
       ".asax,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".ascx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".ashx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".asmx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".asp,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
       ".aspx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".axd,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".cdx,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
       ".cer,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
       ".config,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".cs,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".csproj,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".idc,"+@"c:\windows"+@"\system32\inetsrv\httpodbc.dll,5,GET,POST",
       ".licx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
        ".php,"+"\"D:\\Program Files\\PHP\\php5isapi.dll\",5",
       ".rem,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".resources,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".resx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".shtm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
       ".shtml,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
       ".soap,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".stm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
       ".vb,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".vbproj,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".vsdisco,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".webinfo,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
             };
                //支持 asp
                _script2 = new string[8]{".asa,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
                                         ".asp,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".cdx,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".cer,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".idc,"+@"c:\windows"+@"\system32\inetsrv\httpodbc.dll,5,GET,POST",
              ".shtm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
              ".shtml,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
              ".stm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST"
               };
                //支持 asp/asp.net
                _script3 = new string[26]{".asa,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
               ".asax,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".ascx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".ashx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".asmx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".asp,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
               ".aspx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".axd,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".cdx,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
               ".cer,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
               ".config,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".cs,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".csproj,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".idc,"+@"c:\windows"+@"\system32\inetsrv\httpodbc.dll,5,GET,POST",
               ".licx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               //".php,"+@"c:\windows"+@"\system32\php5isapi.dll,5",
               ".rem,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".resources,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".resx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".shtm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
               ".shtml,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
               ".soap,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".stm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
               ".vb,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".vbproj,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".vsdisco,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".webinfo,"+@"c:\windows"+@"\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG"
       };
                //支持 asp/php
                _script4 = new string[9]{".asa,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".asp,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".cdx,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".cer,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".idc,"+@"c:\windows"+@"\system32\inetsrv\httpodbc.dll,5,GET,POST",
               ".php,"+"\"D:\\Program Files\\PHP\\php5isapi.dll\",5",
              ".shtm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
              ".shtml,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
              ".stm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST"
             };

                if (i == 1)
                {
                    ret = _script1;
                }
                else if (i == 2)
                {
                    ret = _script2;
                }
                else if (i == 3)
                {
                    ret = _script3;
                }
                else
                {
                    ret = _script4;
                }
                return ret;
            }

    public static string[] GetScriptRun(int i)
       {
      string [] _script1;
      string [] _script2;
      string [] _script3;
      string [] _script4;
      string[] ret;
      //支持 asp/asp.net/php
      _script1 = new string[27]{".asa,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
       ".asax,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".ascx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".ashx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".asmx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".asp,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
       ".aspx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".axd,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".cdx,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
       ".cer,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
       ".config,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".cs,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".csproj,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".idc,"+@"c:\windows"+@"\system32\inetsrv\httpodbc.dll,5,GET,POST",
       ".licx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
        ".php,"+"\"D:\\Program Files\\PHP\\php5isapi.dll\",5",
       ".rem,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".resources,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".resx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".shtm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
       ".shtml,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
       ".soap,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".stm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
       ".vb,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".vbproj,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
       ".vsdisco,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
       ".webinfo,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
             };
      //支持 asp
      _script2 = new string[8]{".asa,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
                                         ".asp,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".cdx,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".cer,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".idc,"+@"c:\windows"+@"\system32\inetsrv\httpodbc.dll,5,GET,POST",
              ".shtm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
              ".shtml,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
              ".stm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST"
               };
      //支持 asp/asp.net
      _script3 = new string[26]{".asa,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
               ".asax,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".ascx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".ashx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".asmx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".asp,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
               ".aspx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".axd,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".cdx,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
               ".cer,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
               ".config,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".cs,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".csproj,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".idc,"+@"c:\windows"+@"\system32\inetsrv\httpodbc.dll,5,GET,POST",
               ".licx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               //".php,"+@"c:\windows"+@"\system32\php5isapi.dll,5",
               ".rem,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".resources,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".resx,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".shtm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
               ".shtml,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
               ".soap,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".stm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
               ".vb,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".vbproj,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG",
               ".vsdisco,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,1,GET,HEAD,POST,DEBUG",
               ".webinfo,"+@"c:\windows"+@"\Microsoft.NET\Framework\v1.1.4322\aspnet_isapi.dll,5,GET,HEAD,POST,DEBUG"
       };
      //支持 asp/php
          _script4 = new string[9]{".asa,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".asp,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".cdx,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".cer,"+@"c:\windows"+@"\system32\inetsrv\asp.dll,5,GET,HEAD,POST,TRACE",
              ".idc,"+@"c:\windows"+@"\system32\inetsrv\httpodbc.dll,5,GET,POST",
               ".php,"+"\"D:\\Program Files\\PHP\\php5isapi.dll\",5",
              ".shtm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
              ".shtml,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST",
              ".stm,"+@"c:\windows"+@"\system32\inetsrv\ssinc.dll,5,GET,POST"
             };

          if (i == 1)
          {
              ret = _script1;
          }
          else if (i == 2)
          {
              ret = _script2;
          }
          else if (i == 3)
          {
              ret = _script3;
          }
          else
          {
              ret = _script4;
          }
          return ret;
            }

            /// <summary>
            /// 获取网站绑定的目录
            /// </summary>
            /// <param name="siteName"></param>
            /// <returns></returns>
            public static string GetWebPath(string siteName)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                DirectoryEntry vdEntry = siteEntry.Children.Find("root", "IIsWebVirtualDir");
                return vdEntry.Properties["Path"].Value.ToString();
            }

            /// <summary>
            /// 获取网站文件头文档
            /// </summary>
            /// <param name="siteName"></param>
            /// <returns></returns>
            public static string GetDefautdoclist(string siteName)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                DirectoryEntry vdEntry = siteEntry.Children.Find("root", "IIsWebVirtualDir");
                return vdEntry.Properties["DefaultDoc"].Value.ToString();
            }

            /// <summary>
            /// 设置网站文件头文档
            /// </summary>
            /// <param name="siteName"></param>
            /// <param name="defdoc"></param>
            /// <returns></returns>
            public static void SetDefautdoclist(string siteName, string defdoc)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                DirectoryEntry vdEntry = siteEntry.Children.Find("root", "IIsWebVirtualDir");
                vdEntry.Properties["DefaultDoc"].Value = defdoc;
                vdEntry.CommitChanges();
                siteEntry.CommitChanges();
            }

            public static string GetASPNETVERSION(string siteName)
            {
                string Version = "1.1";
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry newSiteEntry = GetDirectoryEntry(siteEntPath);
                if (newSiteEntry.Properties["ScriptMaps"][1].ToString().IndexOf("v2.0")>0)
                {
                    Version = "2.0";
                }
                //PropertyValueCollection valueCollection = newSiteEntry.Properties["ScriptMaps"];
                //for (int i = 0; i < valueCollection.Count; i++)
                //{
                //    Version += ("[" + i.ToString() + "] =" + valueCollection[i].ToString() + "                                                 ");
                //}
                return Version;

            }

            /// <summary>
            /// 设置ASP.net 的版本
            /// </summary>
            /// <param name="siteName"></param>
            /// <param name="version"></param>
            public static void SetASPNETVERSION(string siteName,string  version,bool asp,bool php,bool isaspnet)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry newSiteEntry = GetDirectoryEntry(siteEntPath);
                newSiteEntry.Properties["ScriptMaps"].Clear();
                if (version == "1.1")
                {
                    if (php & asp & isaspnet)
                    {
                        //三种都支持的情况下
                        newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRun(1);
                    }
                    else if (php & asp & (!isaspnet))
                    {
                        //只支持ASP与PHP的情况下
                        newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRun(4);
                    }
                    else if ((!php) & asp & isaspnet)
                    {
                        //只支持ASP与Asp.NET的情况下
                        newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRun(3);
                    }

                    else if ((!php) & asp & (!isaspnet))
                    {
                        //只支持ASP的情况下
                        newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRun(2);
                    }
                    else
                    {
                        //只支持ASP
                        newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRun(2);
                    }
                }
                else
                {
                    //asp.net 2.0
                    if (php & asp & isaspnet)
                    {
                        //三种都支持的情况下
                        newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRunver2(1);
                    }
                    else if (php & asp & (!isaspnet))
                    {
                        //只支持ASP与PHP的情况下
                        newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRunver2(4);
                    }
                    else if ((!php) & asp & isaspnet)
                    {
                        //只支持ASP与Asp.NET的情况下
                        newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRunver2(3);
                    }

                    else if ((!php) & asp & (!isaspnet))
                    {
                        //只支持ASP的情况下
                        newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRunver2(2);
                    }
                    else
                    {
                        //只支持ASP
                        newSiteEntry.Properties["ScriptMaps"].Value = GetScriptRunver2(2);
                    }
                }

                newSiteEntry.CommitChanges();
            }

            /// <summary>
            /// 获取ASP脚本自定义错误到游览器
            /// </summary>
            /// <param name="siteName"></param>
            /// <returns></returns>
            public static string AspScriptErrorSentToBrowser(string siteName)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                DirectoryEntry vdEntry = siteEntry.Children.Find("root", "IIsWebVirtualDir");
                return vdEntry.Properties["AspScriptErrorSentToBrowser"].Value.ToString() + "|" + vdEntry.Properties["AspScriptErrorMessage"].Value.ToString();
            }

            public static void SetAspScriptErrorSentToBrowser(string siteName, string Message, bool configbool)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                DirectoryEntry vdEntry = siteEntry.Children.Find("root", "IIsWebVirtualDir");
                vdEntry.Properties["AspScriptErrorSentToBrowser"].Value = configbool;
                vdEntry.Properties["AspScriptErrorMessage"].Value = Message;
                vdEntry.CommitChanges();
                siteEntry.CommitChanges();

            }

            public static string[] GetWebinfo(string siteName)
            {
                ArrayList list = new ArrayList();
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                //list.Add(siteEntry.SchemaClassName.ToString());
                list.Add("绑定信息" + "       " + siteEntry.Properties["ServerBindings"].Value.ToString());
                list.Add("站点注释" + "       " + siteEntry.Properties["ServerComment"].Value.ToString());
                list.Add("节点类型" + "$" + siteEntry.Properties["KeyType"].Value.ToString());
                list.Add("读取" + "$" + siteEntry.Properties["AccessRead"][0].ToString());
                list.Add("纯脚本" + "$" + siteEntry.Properties["AccessScript"][0].ToString());
                list.Add("任意文件执行" + "$" + siteEntry.Properties["AccessExecute"][0].ToString());
                list.Add("进程运行" + "$" + siteEntry.Properties["AppIsolated"].Value.ToString());
                list.Add("日志目录" + "$" + siteEntry.Properties["LogFileDirectory"].Value.ToString());
                list.Add("限制最大带宽" + "$" + siteEntry.Properties["MaxBandwidth"].Value.ToString());
                list.Add("限制最大连接数" + "$" + siteEntry.Properties["MaxConnections"].Value.ToString());
                DirectoryEntry vdEntry = siteEntry.Children.Find("root", "IIsWebVirtualDir");
                list.Add("应用程序路径" + "$" + vdEntry.Properties["AppRoot"].Value);
                list.Add("站点磁盘路径" + "$" + vdEntry.Properties["Path"].Value);
                list.Add("启用默认内容文档" + "$" + vdEntry.Properties["EnableDefaultDoc"][0].ToString());
                list.Add("应用程序名" + "$" + vdEntry.Properties["AppFriendlyName"].Value);
                list.Add("应用程序池" + "$" + vdEntry.Properties["AppPoolId"].Value);
                list.Add("匿名帐号" + "$" + vdEntry.Properties["AnonymousUserName"].Value);
                list.Add("匿名帐号密码" + "$" + vdEntry.Properties["AnonymousUserPass"].Value);
                list.Add("默认文档" + "$" + vdEntry.Properties["DefaultDoc"].Value);
                list.Add("启用文档页脚" + "$" + vdEntry.Properties["DefaultDocFooter"].Value);
                list.Add("目录浏览" + "$" + vdEntry.Properties["EnableDirBrowsing"][0].ToString());
                list.Add("写入权限" + "$" + vdEntry.Properties["AccessWrite"][0].ToString());
                list.Add("自定义404错误" + "$" + vdEntry.Properties["HttpErrors"][26].ToString());
                list.Add("启用客户端脚本调试" + "$" + vdEntry.Properties["AppAllowClientDebug"].Value.ToString());
                list.Add("启用父路径" + "$" + vdEntry.Properties["AspEnableParentPaths"].Value.ToString());
                list.Add("启用ASP会话" + "$" + vdEntry.Properties["AspAllowSessionState"].Value.ToString());
                list.Add("会话Session超时时间" + "$" + vdEntry.Properties["AspSessionTimeout"].Value.ToString());
                list.Add("默认脚本语言" + "$" + vdEntry.Properties["AspScriptLanguage"].Value.ToString());
                list.Add("脚本执行超时时间" + "$" + vdEntry.Properties["AspScriptTimeout"].Value.ToString());
                list.Add("同时最大请求数" + "$" + vdEntry.Properties["AspRequestQueueMax"].Value.ToString());
                list.Add("是否将错误信息发送到客户端" + "$" + vdEntry.Properties["AspScriptErrorSentToBrowser"].Value.ToString());
                string denpip = "拒绝IP地址访问";
                Type typ = vdEntry.Properties["IPSecurity"][0].GetType();
                object IPSecurity = vdEntry.Properties["IPSecurity"][0];
                Array origIPDenyList = (Array)typ.InvokeMember("IPDeny", BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty, null, IPSecurity, null);
                foreach (string s in origIPDenyList)
                    denpip += s.ToString();
                list.Add(denpip);
                if (list.Count == 0)
                    return new string[0];
                else
                    return (string[])list.ToArray(typeof(string));
            }

            /// <summary>
            /// 删除一个网站。根据网站名称删除。
            /// </summary>
            /// <param name="siteName">网站名称</param>

            public static void DeleteWebSiteByName(string siteName)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                string rootPath = String.Format("IIS://{0}/w3svc", HostName);
                DirectoryEntry rootEntry = GetDirectoryEntry(rootPath);
                rootEntry.Children.Remove(siteEntry);
                rootEntry.CommitChanges();

            }

            #endregion

            public static string Getwebstaus(string siteName)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                return isstate(Convert.ToInt32(siteEntry.Properties["ServerState"].Value));
            }

            #region Start和Stop网站的方法

            public static void StartWebSite(string siteName)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                siteEntry.Invoke("Start", new object[] { });
            }

            public static void StopWebSite(string siteName)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                siteEntry.Invoke("Stop", new object[] { });
            }

            public static void Configweb404(string siteName)
            {
                string siteNum = GetWebSiteNum(siteName);
                string siteEntPath = String.Format("IIS://{0}/w3svc/{1}", HostName, siteNum);
                DirectoryEntry siteEntry = GetDirectoryEntry(siteEntPath);
                //为该站点目录创建一个HttpErrors,并且创建404错误
                DirectoryEntry vdEntry = siteEntry.Children.Find("root", "IIsWebVirtualDir");
                if (!System.IO.Directory.Exists(vdEntry.Properties["path"][0].ToString()+"\\HttpErrors"))
                {
                    System.IO.Directory.CreateDirectory(vdEntry.Properties["path"][0].ToString() + "\\HttpErrors");
                }
                siteEntry.Properties["HttpErrors"][26] = "404,*,FILE," + vdEntry.Properties["path"][0].ToString() + "\\HttpErrors\\404.htm";
                 siteEntry.CommitChanges();
            }

            #endregion

            #region 获取所有应用程序池列表
            public static string[] ListAllAppPools()
            {
                ArrayList list = new ArrayList();
                DirectoryEntry directoryEntry = GetDirectoryEntry("IIS://LOCALHOST/W3SVC/AppPools");
                foreach (DirectoryEntry entry2 in directoryEntry.Children)
                {
                    PropertyCollection properties = entry2.Properties;
                    list.Add(entry2.Name + "$" + isstate(Convert.ToInt32(entry2.Properties["AppPoolState"].Value.ToString())));
                }

                if (list.Count == 0)
                    return new string[0];
                else
                    return (string[])list.ToArray(typeof(string));
            }
            #endregion

            public static string isstate(int state)
            {
                string retstr = "未知";
                if (state == 4)
                    retstr = "已停止";
                else if (state == 2)
                    retstr = "正在运行";
                else if (state == 6)
                    retstr = "已暂停";
                return retstr;
            }

            #region 获取所有网站列表
            public static string[] ListAllwebsite()
            {
                string entPath = String.Format("IIS://{0}/w3svc", HostName);
                DirectoryEntry ent = GetDirectoryEntry(entPath);
                ArrayList list = new ArrayList();
                foreach (DirectoryEntry child in ent.Children)
                {
                    if (child.SchemaClassName == "IIsWebServer")
                    {
                        //ServerBindings
                        list.Add(child.Properties["ServerComment"].Value.ToString() + '$' + isstate(Convert.ToInt32(child.Properties["ServerState"].Value.ToString())));//状态4代表停止,2代表运行//6代表暂停
                    }
                }

                if (list.Count == 0)
                    return new string[0];
                else
                    return (string[])list.ToArray(typeof(string));
            }
            #endregion

            #region 确认网站是否相同
            /// <summary>
            /// 确定一个新的网站与现有的网站没有相同的。
            /// 这样防止将非法的数据存放到IIS里面去
            /// </summary>
            /// <param name="bindStr">网站邦定信息</param>
            /// <returns>真为可以创建,假为不可以创建</returns>
            public static bool EnsureNewSiteEnavaible(string bindStr)
            {
                string entPath = String.Format("IIS://{0}/w3svc", HostName);
                DirectoryEntry ent = GetDirectoryEntry(entPath);
                foreach (DirectoryEntry child in ent.Children)
                {
                    if (child.SchemaClassName == "IIsWebServer")
                    {
                        if (child.Properties["ServerBindings"].Value != null)
                        {
                            if (child.Properties["ServerBindings"].Value.ToString() == bindStr)
                            {
                                return false;
                            }
                        }
                    }
                }
                return true;
            }

            #endregion
            #region 获取一个网站编号的方法
            /// <summary>
            /// 获取一个网站的编号。根据网站的ServerBindings或者ServerComment来确定网站编号
            /// </summary>
            /// <param name="siteName"></param>
            /// <returns>返回网站的编号</returns>
            /// <exception cref="NotFoundWebSiteException">表示没有找到网站</exception>

            public static string GetWebSiteNum(string siteName)
            {
                Regex regex = new Regex(siteName);
                string tmpStr;
                string entPath = String.Format("IIS://{0}/w3svc", HostName);
                string retstr = string.Empty;
                DirectoryEntry ent = GetDirectoryEntry(entPath);
                foreach (DirectoryEntry child in ent.Children)
                {
                    if (child.SchemaClassName == "IIsWebServer")
                    {
                        //if (child.Properties["ServerBindings"].Value != null)
                        //{
                        //    tmpStr = child.Properties["ServerBindings"].Value.ToString();
                        //    if (regex.Match(tmpStr).Success)
                        //    {
                        //        retstr = child.Name;
                        //    }
                        //}
                        if (child.Properties["ServerComment"].Value != null)
                        {
                            tmpStr = child.Properties["ServerComment"].Value.ToString();
                            if (tmpStr==siteName)
                            {
                                retstr = child.Name;
                            }
                        }
                    }
                }
                return retstr;
                //throw new NotFoundWebSiteException("没有找到我们想要的站点" + siteName);
            }

            #endregion
            #region 获取新网站id的方法
            /// <summary>
            /// 获取网站系统里面可以使用的最小的ID。
            /// 这是因为每个网站都需要有一个唯一的编号,而且这个编号越小越好。
            /// 这里面的算法经过了测试是没有问题的。
            /// </summary>
            /// <returns>最小的id</returns>

            public static string GetNewWebSiteID()
            {
                ArrayList list = new ArrayList();
                string tmpStr;
                string entPath = String.Format("IIS://{0}/w3svc", HostName);
                DirectoryEntry ent = GetDirectoryEntry(entPath);
                foreach (DirectoryEntry child in ent.Children)
                {
                    if (child.SchemaClassName == "IIsWebServer")
                    {
                        tmpStr = child.Name.ToString();
                        list.Add(Convert.ToInt32(tmpStr));
                    }
                }
                list.Sort();
                int i = 1;
                foreach (int j in list)
                {
                    if (i == j)
                    {
                        i++;
                    }
                }
                return i.ToString();
            }
            #endregion
        }

        #region 新网站信息结构体

        public struct NewWebSiteInfo
        {
            private string hostIP; //The Hosts IP Address
            private string portNum; //The New Web Sites Port.generally is "80"
            private string descOfWebSite; //网站表示。一般为网站的网站名。例如"www.dns.com.cn"
            private string commentOfWebSite;//网站注释。一般也为网站的网站名。
            private string webPath; //网站的主目录。例如"e: mp"
            public NewWebSiteInfo(string hostIP, string portNum, string descOfWebSite, string commentOfWebSite, string webPath)
            {
                this.hostIP = hostIP;
                this.portNum = portNum;
                this.descOfWebSite = descOfWebSite;
                this.commentOfWebSite = commentOfWebSite;
                this.webPath = webPath;
            }
            public string BindString
            {
                get
                {
                    return String.Format("{0}:{1}:{2}", hostIP, portNum, descOfWebSite);
                }
            }
            public string CommentOfWebSite
            {
                get
                {
                    return commentOfWebSite;
                }
            }
            public string WebPath
            {
                get
                {
                    return webPath;
                }
            }
        }
        #endregion

    }

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.IO;
    using Microsoft.Win32;
    using System.Diagnostics;
    namespace DvCMS.vHost.client
    {
        /// <summary>
        /// .INI文件 操作。
        /// </summary>
        public class ftpini
        {
            /// <summary>
            /// 创建一个如下的INI对象
            /// INI ini = new INI(@"C:\test.ini");
            /// </summary>

            public string path;
            //引用动态连接库方法
            [DllImport("kernel32")]
            private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
            [DllImport("kernel32")]
            private static extern int GetPrivateProfileString(string section, string key, string def, StringBuilder retVal, int size, string filePath);

            /// <summary>
            /// 写入数据
            /// </summary>
            /// <PARAM name="Section"></PARAM>
            /// 节点名
            /// <PARAM name="Key"></PARAM>
            /// 键名
            /// <PARAM name="Value"></PARAM>
            /// 值名
            public void Write(string Section, string Key, string value, string path)
            {
                WritePrivateProfileString(Section, Key, value, path);
            }
            /// <summary>
            /// 读取INI数据
            /// </summary>
            /// <PARAM name="Section"></PARAM>
            /// <PARAM name="Key"></PARAM>
            /// <PARAM name="Path"></PARAM>
            /// <returns></returns>
            public string Read(string Section, string Key)
            {
                StringBuilder temp = new StringBuilder(255);
                string path = System.Configuration.ConfigurationManager.AppSettings["FTPinstallpath"] + "ServUDaemon.ini";
                int i = GetPrivateProfileString(Section, Key, "", temp, 255, path);
                return temp.ToString();
            }

            public void EditFtppassword(string ftpaccount, string ftppassword)
            {
                string FTPinstallpath = System.Configuration.ConfigurationManager.AppSettings["FTPinstallpath"];
                this.Write("USER=" + ftpaccount + "|1", "Password", "dv" + System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("dv" + ftppassword, "md5"), FTPinstallpath + "ServUDaemon.ini");
                this.Write("GLOBAL", "ReloadSettings", "True", FTPinstallpath + "ServUDaemon.ini");
            }
            /// <summary>
            /// 开通FTP帐号
            /// </summary>
            /// <param name="ftpaccount"></param>
            /// <param name="ftppassword"></param>
            /// <param name="Homedir"></param>
            /// <param name="spaceM"></param>
            /// <param name="maxupload"></param>
            /// <param name="maxdownload"></param>
            /// <param name="sessiontimeout"></param>
            /// <param name="maxusercon"></param>
            /// <returns></returns>
            public void OpenFtp(string ftpaccount, string ftppassword, string Homedir, string spaceM, string proid)
            {
                string MaxUpload = System.Configuration.ConfigurationManager.AppSettings["MaxUpload"];
                string MaxDownload = System.Configuration.ConfigurationManager.AppSettings["MaxDownload"];
                string SessionTimeOut = System.Configuration.ConfigurationManager.AppSettings["SessionTimeOut"];
                string MaxUserConnection = System.Configuration.ConfigurationManager.AppSettings["MaxUserConnection"];
                string FTPinstallpath = System.Configuration.ConfigurationManager.AppSettings["FTPinstallpath"];
                //向FTP安装目录ServUDaemon.ini写入用户记录
                this.Write("Domain1", "User" + proid.Trim(), ftpaccount + "|1|0", FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "Password", "dv" + System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile("dv" + ftppassword, "md5"), FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "HomeDir", Homedir, FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "RelPaths", "1", FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "HideHidden", "1", FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "PasswordLastChange", "1183865700", FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "SpeedLimitUp", (Convert.ToInt32(MaxUpload) * 1024).ToString(), FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "SpeedLimitDown", (Convert.ToInt32(MaxDownload) * 1024).ToString(), FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "TimeOut", "600", FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "SessionTimeOut", (Convert.ToInt32(SessionTimeOut) * 60).ToString(), FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "MaxNrUsers", MaxUserConnection, FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "Access1", Homedir + "|RWAMLCDP", FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "DiskQuota", "1|" + (Convert.ToInt32(spaceM) * 1024 * 1024).ToString() + "|0", FTPinstallpath + "ServUDaemon.ini");
                this.Write("USER=" + ftpaccount + "|1", "Enable", "1", FTPinstallpath + "ServUDaemon.ini");
                this.Write("GLOBAL", "ReloadSettings", "True", FTPinstallpath + "ServUDaemon.ini");
                //创建这个目录
                if (!System.IO.Directory.Exists(Homedir))
                {
                    System.IO.Directory.CreateDirectory(Homedir);
                }
                if (!System.IO.Directory.Exists(Homedir+"/wwwroots"))
                {
                    System.IO.Directory.CreateDirectory(Homedir+"/wwwroots");
                }
                   if (!System.IO.Directory.Exists(Homedir+"/Logfiles"))
                {
                    System.IO.Directory.CreateDirectory(Homedir+"/Logfiles");
                }
                if (!System.IO.Directory.Exists(Homedir + "/Database"))
                {
                    System.IO.Directory.CreateDirectory(Homedir + "/Database");
                }

            }

            ///   <summary>  
            /// 递归读取所有目录大小  
            ///   </summary>  
            ///   <param   name="FolderPath">文件目录</param>  
            ///   <param   name="size">初始大小</param>  
            ///   <returns>返回字节</returns>  
            public long FolderSize(string FolderPath, long size)
            {
                long Csize = size;
                string[] Folder = Directory.GetDirectories(FolderPath);
                string[] files = Directory.GetFiles(FolderPath);
                int i = 0;
                for (i = 0; i < files.Length; i++)
                {
                    try
                    {
                        FileAttributes fa = File.GetAttributes(files[i]);
                        FileInfo f = new FileInfo(files[i]);
                        Console.WriteLine(files[i] + "大小:" + f.Length);
                        Csize += f.Length;
                    }
                    catch
                    {
                        //("读取文件失败");
                    }

                }

                for (i = 0; i < Folder.Length; i++)
                {
                    FolderSize(Folder[i], Csize);
                }
                return Csize;
            }

            public string unzip(string rarpath, string savepath, bool rewrite)
            {
                //解压缩
                string retstr = string.Empty;
                String the_rar;
                RegistryKey the_Reg;
                Object the_Obj;
                String the_Info;
                ProcessStartInfo the_StartInfo;
                Process the_Process;
                try
                {
                    the_Reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRar.exe\Shell\Open\Command");
                    the_Obj = the_Reg.GetValue("");
                    the_rar = the_Obj.ToString();
                    the_Reg.Close();
                    the_rar = the_rar.Substring(1, the_rar.Length - 7);
                    if (rewrite)
                    {
                        //判断是否要覆盖旧文件
                        the_Info = " X " + rarpath + " " + savepath + "  " + "-o+";
                    }
                    else
                    {
                        the_Info = " X " + rarpath + " " + savepath + "  ";
                    }
                    the_StartInfo = new ProcessStartInfo();
                    the_StartInfo.FileName = the_rar;
                    the_StartInfo.Arguments = the_Info;
                    the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    the_Process = new Process();
                    the_Process.StartInfo = the_StartInfo;
                    the_Process.Start();
                    retstr="恭喜您,已经解压缩成功,请使用FTP软件登录FTP服务器移动文件或整理";
                }
                catch (Exception ex)
                {
                    retstr = ex.Message;
                }
                return retstr;
            }

            public string zip(string path,string savepath, bool childfolder)
            {
                //压缩
                string retstr = string.Empty;
                String the_rar;
                RegistryKey the_Reg;
                Object the_Obj;
                String the_Info;
                ProcessStartInfo the_StartInfo;
                Process the_Process;
                System.Random rdn = new System.Random();
                string newrarfile = System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Millisecond.ToString()+rdn.Next(99999999).ToString()+".rar";
                //try
                //{
                    the_Reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRAR.exe\Shell\Open\Command");
                    the_Obj = the_Reg.GetValue("");
                    the_rar = the_Obj.ToString();
                    the_Reg.Close();
                    the_rar = the_rar.Substring(1, the_rar.Length - 7);
                    //判断是否将子文件夹也一起打包
                    if (childfolder)
                    {
                        the_Info = " a    " + newrarfile + "  " + path + "  " + "-r";
                    }
                    else
                    {
                        the_Info = " a    " + newrarfile + "  " + path;
                    }
                    the_StartInfo = new ProcessStartInfo();
                    the_StartInfo.FileName = the_rar;
                    the_StartInfo.Arguments = the_Info;
                    the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    the_StartInfo.WorkingDirectory = savepath;//获取或设置要启动的进程的初始目录。
                    the_Process = new Process();
                    the_Process.StartInfo = the_StartInfo;
                    the_Process.Start();
                    retstr = "恭喜您,已经压缩成功,请使用FTP软件登录FTP服务器下载,文件名为:" + newrarfile;
                //}
                //catch (Exception ex)
                //{
                //    retstr = ex.Message;
                //}
                return retstr;
            }

        }
    }

    using System;
    using System.Data;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    namespace DvCMS.vHost.client
    {
        /// <summary>
        /// Sqldmo 的摘要说明
        /// </summary>
        public class Sqldmo
        {
            public Sqldmo()
            {
                //
                // TODO: 在此处添加构造函数逻辑
                //
            }
            public static string RestoreDB(string dbname, string rebakpath)
            {
                SQLDMO.SQLServer svr = new SQLDMO.SQLServerClass();
                string retstr = string.Empty;
                try
                {
                    svr.Connect("127.0.0.1", System.Configuration.ConfigurationManager.AppSettings["Sqlsa"], System.Configuration.ConfigurationManager.AppSettings["Sqlsapassword"]);

                    //进程杀死部分
                    SQLDMO.QueryResults qr = svr.EnumProcesses(-1);
                    int iColPIDNum = -1;
                    int iColDbName = -1;
                    for (int i = 1; i <= qr.Columns; i++)
                    {
                        string strName = qr.get_ColumnName(i);
                        if (strName.ToUpper().Trim() == "SPID")
                        {
                            iColPIDNum = i;
                        }
                        else if (strName.ToUpper().Trim() == "DBNAME")
                        {
                            iColDbName = i;
                        }
                        if (iColPIDNum != -1 && iColDbName != -1)
                            break;
                    }
                    //杀死使用strDbName数据库的进程  
                    for (int i = 1; i <= qr.Rows; i++)
                    {
                        int lPID = qr.GetColumnLong(i, iColPIDNum);
                        string strDBName = qr.GetColumnString(i, iColDbName);
                        if (strDBName.ToUpper() == dbname.ToUpper())
                        {
                            svr.KillProcess(lPID);
                        }
                    }    

                    //进程杀死结束
                    SQLDMO.Restore res = new SQLDMO.RestoreClass();
                    res.Action = 0;
                    res.Files = rebakpath;
                    res.Database = dbname;
                    res.ReplaceDatabase = true;
                    res.SQLRestore(svr);
                    retstr = "恭喜您,数据库成功恢复";
                }
                catch (Exception ex)
                {
                    retstr = ex.Message;
                }
                finally
                {
                    svr.DisConnect();
                    svr.Close();
                }
                return retstr;
            }

            public static void StopSql()
            {
                SQLDMO.Backup oBackup = new SQLDMO.BackupClass();
                SQLDMO.SQLServer oSQLServer = new SQLDMO.SQLServerClass();
                SQLDMO.Application sqlApp = null;
                SQLDMO.SQLServer srv = null;
                string retstr = string.Empty;
                try
                {
                    sqlApp = new SQLDMO.ApplicationClass();
                    oSQLServer.Connect("127.0.0.1", System.Configuration.ConfigurationManager.AppSettings["Sqlsa"], System.Configuration.ConfigurationManager.AppSettings["Sqlsapassword"]);
                    oSQLServer.Stop(); 

                }
                catch (Exception ex)
                {
                    retstr = ex.Message;
                }
                finally
                {
                    oSQLServer.DisConnect();
                    oSQLServer.Close();
                    sqlApp.Quit();
                }
            }

            public static string  SqlStatus()
            {
                SQLDMO.Backup oBackup = new SQLDMO.BackupClass();
                SQLDMO.SQLServer oSQLServer = new SQLDMO.SQLServerClass();
                SQLDMO.Application sqlApp = null;
                SQLDMO.SQLServer srv = null;
                string retstr = string.Empty;
                try
                {
                    sqlApp = new SQLDMO.ApplicationClass();
                   oSQLServer.Connect("127.0.0.1", System.Configuration.ConfigurationManager.AppSettings["Sqlsa"], System.Configuration.ConfigurationManager.AppSettings["Sqlsapassword"]);
                   retstr=oSQLServer.Status.ToString();

                }
                catch (Exception ex)
                {
                    retstr = ex.Message;
                }
                finally
                {
                    oSQLServer.DisConnect();
                    oSQLServer.Close();
                    sqlApp.Quit();
                }
                return retstr;
            }

            public static void Shutdown()
            {
                SQLDMO.Backup oBackup = new SQLDMO.BackupClass();
                SQLDMO.SQLServer oSQLServer = new SQLDMO.SQLServerClass();
                SQLDMO.Application sqlApp = null;
                SQLDMO.SQLServer srv = null;
                string retstr = string.Empty;
                try
                {
                    sqlApp = new SQLDMO.ApplicationClass();
                    oSQLServer.Connect("127.0.0.1", System.Configuration.ConfigurationManager.AppSettings["Sqlsa"], System.Configuration.ConfigurationManager.AppSettings["Sqlsapassword"]);
                    oSQLServer.Shutdown(0);  

                }
                catch (Exception ex)
                {
                    retstr = ex.Message;
                }
                finally
                {
                    oSQLServer.DisConnect();
                    oSQLServer.Close();
                    sqlApp.Quit();
                }
            }

            public static void StartSql()
            {
                SQLDMO.Backup oBackup = new SQLDMO.BackupClass();
                SQLDMO.SQLServer oSQLServer = new SQLDMO.SQLServerClass();
                SQLDMO.Application sqlApp = null;
                SQLDMO.SQLServer srv = null;
                string retstr = string.Empty;
                try
                {
                    sqlApp = new SQLDMO.ApplicationClass();
                    oSQLServer.Start(true, "127.0.0.1", System.Configuration.ConfigurationManager.AppSettings["administrator"].Trim(), System.Configuration.ConfigurationManager.AppSettings["password"].Trim());
                }
                catch (Exception ex)
                {
                    retstr = ex.Message;
                }
                finally
                {
                    oSQLServer.DisConnect();
                    oSQLServer.Close();
                    sqlApp.Quit();
                }
            }
            public static string Getdbsize(string dbname)
            {
                SQLDMO.Backup oBackup = new SQLDMO.BackupClass();
                SQLDMO.SQLServer oSQLServer = new SQLDMO.SQLServerClass();
                SQLDMO.Application sqlApp = null;
                SQLDMO.SQLServer srv = null;
                string retstr = string.Empty;
                try
                {
                    sqlApp = new SQLDMO.ApplicationClass();
                    oSQLServer.Connect("127.0.0.1", System.Configuration.ConfigurationManager.AppSettings["Sqlsa"], System.Configuration.ConfigurationManager.AppSettings["Sqlsapassword"]);

                    SQLDMO._Database dbn = oSQLServer.Databases.Item(dbname, "dbo");
                        retstr = dbn.Size.ToString() + "M";
                }
                catch (Exception ex)
                {
                    retstr = ex.Message;
                }
                finally
                {
                    oSQLServer.DisConnect();
                    oSQLServer.Close();
                    sqlApp.Quit();
                }
                return retstr;
            }

            public static string Backupdb(string dbname, string ftppath)
            {
                SQLDMO.Backup oBackup = new SQLDMO.BackupClass();
                SQLDMO.SQLServer oSQLServer = new SQLDMO.SQLServerClass();
                SQLDMO.Application sqlApp = null;
                SQLDMO.SQLServer srv = null;
                string retstr = string.Empty;
                try
                {
                    sqlApp = new SQLDMO.ApplicationClass();
                    oSQLServer.Connect("127.0.0.1", System.Configuration.ConfigurationManager.AppSettings["Sqlsa"], System.Configuration.ConfigurationManager.AppSettings["Sqlsapassword"]);
                    oBackup.Action = SQLDMO.SQLDMO_BACKUP_TYPE.SQLDMOBackup_Database;
                    oBackup.Database = dbname;
                    System.Random rdn = new System.Random();
                    string folder = System.DateTime.Now.Year.ToString() + System.DateTime.Now.Month.ToString() + System.DateTime.Now.Day.ToString() + System.DateTime.Now.Hour.ToString() + System.DateTime.Now.Minute.ToString() + System.DateTime.Now.Second.ToString() + rdn.Next(99999999).ToString();
                    //创建目录
                    if (!System.IO.Directory.Exists(ftppath + "\\" + folder))
                        System.IO.Directory.CreateDirectory(ftppath + "\\" + folder);

                    string filename = dbname + "_" + folder + ".bak";
                    oBackup.Files = "[" + ftppath + "\\" + folder + "\\" + filename + "]";
                    oBackup.BackupSetDescription = "数据库备份";
                    oBackup.Initialize = true;
                    oBackup.SQLBackup(oSQLServer);
                    //继续进行压缩
                    DvCMS.vHost.client.ftpini ftp = new ftpini();
                    retstr = ftp.zip(ftppath + "\\" + folder + @"\*.*", ftppath + "\\" + folder, true).Replace("恭喜您,已经压缩成功,请使用FTP软件登录FTP服务器下载,文件名为:", " ").Trim();
                    //删除以前的备份文件

                    retstr = ftppath + "\\" + folder + "\\" + filename + "|" + "http://" + System.Configuration.ConfigurationManager.AppSettings["Databasedownloadwebsite"].ToString() + "/"  + folder + "/" + retstr;
                }
                catch (Exception ex)
                {
                    retstr = ex.Message;
                }
                finally
                {
                    oSQLServer.DisConnect();
                    oSQLServer.Close();
                    sqlApp.Quit();
                }
                return retstr;
            }

            public static string  Resetuserpass(string username, string oldpassword, string newpassword)
            {
                SQLDMO.Application sqlApp = null;
                SQLDMO.SQLServer srv = null;
                string retstr = string.Empty;
                try
                {
                    sqlApp = new SQLDMO.ApplicationClass();
                    srv = new SQLDMO.SQLServerClass();
                    srv.Connect("127.0.0.1", System.Configuration.ConfigurationManager.AppSettings["Sqlsa"], System.Configuration.ConfigurationManager.AppSettings["Sqlsapassword"]);
                    SQLDMO.Login loginuser = new SQLDMO.Login();
                    loginuser.Name = username;
                    loginuser.SetPassword(oldpassword, newpassword);
                    retstr = "恭喜您,密码修改成功";
                }
                catch (Exception ex)
                {
                    retstr = ex.Message;
                }
                finally
                {
                    srv.DisConnect();
                    srv.Close();
                    sqlApp.Quit();
                }
                return retstr;
            }

            public static  string  deletedb(string dbname,string username)
            {
                SQLDMO.Application sqlApp = null;
                SQLDMO.SQLServer srv = null;
                string retstr = string.Empty;
                try
                {
                    sqlApp = new SQLDMO.ApplicationClass();
                    srv = new SQLDMO.SQLServerClass();
                    srv.Connect("127.0.0.1", System.Configuration.ConfigurationManager.AppSettings["Sqlsa"], System.Configuration.ConfigurationManager.AppSettings["Sqlsapassword"]);
                    SQLDMO.Database nDB = new SQLDMO.Database();
                    nDB.Name = dbname;
                    srv.Databases.Remove(nDB.Name, nDB.Owner);//删除数据库
                    SQLDMO.Login loginuser = new SQLDMO.Login();
                    loginuser.Name = username;
                    srv.Logins.Remove(loginuser.Name);

                    retstr = "恭喜您,指定的数据库删除成功";
                }
                catch (Exception ex)
                {
                    retstr = ex.Message;
                }
                finally
                {
                    srv.DisConnect();
                    srv.Close();
                    sqlApp.Quit();
                }
                return retstr;

            }

            ///   <summary>  
            ///   创建数据库。  
            ///   </summary>
            ///   <param name="dbName">指定要创建的数据库名</param>
            public  static string CreateDB(string dbName,int maxdbsize,string username,string password)
            {    SQLDMO.Application sqlApp=null;
                 SQLDMO.SQLServer srv=null;
                 string rvCDB = string.Empty;
                try
                {
                    sqlApp = new SQLDMO.ApplicationClass();
                    srv = new SQLDMO.SQLServerClass();
                    srv.Connect("127.0.0.1", System.Configuration.ConfigurationManager.AppSettings["Sqlsa"], System.Configuration.ConfigurationManager.AppSettings["Sqlsapassword"]);

                    // 新建数据库名(包括路径)
                    string dbPath = srv.Registry.SQLDataRoot + "\\DATA\\" + dbName;

                    bool DBExist = false;
                    foreach (SQLDMO.Database db in srv.Databases)//判断当前库中是否已经存在这个库
                    {
                        if (db.Name == dbName)
                        {
                            DBExist = true;
                        }
                    }
                    //函数返回结果

                    if (DBExist)
                    {
                        rvCDB = "此数据库存名已存在请选择其它名称";

                    }
                    else
                    {
                        rvCDB = "恭喜您,成功创建数据库!";
                        SQLDMO.Database nDB = new SQLDMO.Database();//实例化数据库对象
                        SQLDMO.DBFile nDBFile = new SQLDMO.DBFile();//实例化数据文件
                        SQLDMO.LogFile nLogFile = new SQLDMO.LogFile();//实例化日志文件
                        nDB.Name = dbName;
                        nDBFile.Name = dbName + "file";
                        nDBFile.PhysicalName = dbPath + "_Data.mdf";
                        nDBFile.MaximumSize = maxdbsize;
                        nDBFile.PrimaryFile = true;
                        nDBFile.FileGrowthType = 0;
                        nDBFile.FileGrowth = 1;
                        nDB.FileGroups.Item("primary").DBFiles.Add(nDBFile);
                        nLogFile.Name = dbName + "log";
                        nLogFile.PhysicalName = dbPath + "_Log.ldf";
                        nDB.TransactionLog.LogFiles.Add(nLogFile);
                        srv.Databases.Add(nDB);
                        //添加一个用户
                        SQLDMO.Login loginuser = new SQLDMO.Login();
                        loginuser.Name = username;
                        loginuser.SetPassword("", password);
                        srv.Logins.Add(loginuser);
                        loginuser.Database = nDB.Name;
                        SQLDMO.User user = new SQLDMO.User();
                        user.Name = loginuser.Name;
                        user.Login = loginuser.Name;
                        nDB.Users.Add(user);
                        nDB.DatabaseRoles.Item("db_owner").AddMember(user.Name);
                    }
                }
                catch (Exception ex)
                {
                    rvCDB = ex.Message;
                }
                finally
                {
                    srv.DisConnect();
                    srv.Close();
                    sqlApp.Quit();
                }
                return rvCDB;

            }
        }
    }

    using System;
    using System.Management;
    using System.Collections;
    using System.Collections.Specialized;
    using System.Runtime.InteropServices;
    using System.Text;
    using Microsoft.Win32;
    using System.Diagnostics;
    namespace DvCMS.vHost.client
    {
        #region WMIPath
        public enum WMIPath
        {
            // 硬件
            Win32_Processor, // CPU 处理器
            Win32_PhysicalMemory, // 物理内存条
            Win32_Keyboard, // 键盘
            Win32_PointingDevice, // 点输入设备,包括鼠标。
            Win32_FloppyDrive, // 软盘驱动器
            Win32_DiskDrive, // 硬盘驱动器
            Win32_CDROMDrive, // 光盘驱动器
            Win32_BaseBoard, // 主板
            Win32_BIOS, // BIOS 芯片
            Win32_ParallelPort, // 并口
            Win32_SerialPort, // 串口
            Win32_SerialPortConfiguration, // 串口配置
            Win32_SoundDevice, // 多媒体设置,一般指声卡。
            Win32_SystemSlot, // 主板插槽 (ISA & PCI & AGP)
            Win32_USBController, // USB 控制器
            Win32_NetworkAdapter, // 网络适配器
            Win32_NetworkAdapterConfiguration, // 网络适配器设置
            Win32_Printer, // 打印机
            Win32_PrinterConfiguration, // 打印机设置
            Win32_PrintJob, // 打印机任务
            Win32_TCPIPPrinterPort, // 打印机端口
            Win32_POTSModem, // MODEM
            Win32_POTSModemToSerialPort, // MODEM 端口
            Win32_DesktopMonitor, // 显示器
            Win32_DisplayConfiguration, // 显卡
            Win32_DisplayControllerConfiguration, // 显卡设置
            Win32_VideoController, // 显卡细节。
            Win32_VideoSettings, // 显卡支持的显示模式。

            // 操作系统
            Win32_TimeZone, // 时区
            Win32_SystemDriver, // 驱动程序
            Win32_DiskPartition, // 磁盘分区
            Win32_LogicalDisk, // 逻辑磁盘
            Win32_LogicalDiskToPartition, // 逻辑磁盘所在分区及始末位置。
            Win32_LogicalMemoryConfiguration, // 逻辑内存配置
            Win32_PageFile, // 系统页文件信息
            Win32_PageFileSetting, // 页文件设置
            Win32_BootConfiguration, // 系统启动配置
            Win32_ComputerSystem, // 计算机信息简要
            Win32_OperatingSystem, // 操作系统信息
            Win32_StartupCommand, // 系统自动启动程序
            Win32_Service, // 系统安装的服务
            Win32_Group, // 系统管理组
            Win32_GroupUser, // 系统组帐号
            Win32_UserAccount, // 用户帐号
            Win32_Process, // 系统进程
            Win32_Thread, // 系统线程
            Win32_Share, // 共享
            Win32_NetworkClient, // 已安装的网络客户端
            Win32_NetworkProtocol, // 已安装的网络协议
        }
        #endregion

        /// <summary>
        /// 获取系统信息
        /// </summary>
        /// <example>
        /// <code>
        /// WMI w = new WMI(WMIPath.Win32_NetworkAdapterConfiguration);
        /// for (int i = 0; i < w.Count; i )
        /// {
        /// if ((bool)w[i, "IPEnabled"])
        /// {
        /// Console.WriteLine("Caption:{0}", w[i, "Caption"]);
        /// Console.WriteLine("MAC Address:{0}", w[i, "MACAddress"]);
        /// }
        /// }
        /// </code>
        /// </example>
        public sealed class WMI
        {
            private ArrayList mocs;
            private StringDictionary names; //用来存储属性名,便于忽略大小写查询正确名称。

            /// <summary>
            /// 返回测试信息。
            /// </summary>
            /// <returns></returns>
            public  string Test()
            {
                try
                {
                    StringBuilder result = new StringBuilder(1000);

                    for (int i = 0; i < Count; i++)
                    {
                        int j = 0;
                        foreach (string s in PropertyNames(i))
                        {
                            result.Append(string.Format("{0}:{1}={2}<bR>", j, s, this[i, s]));

                            if (this[i, s] is Array)
                            {
                                Array v1 = this[i, s] as Array;
                                for (int x = 0; x < v1.Length; x++)
                                {
                                    result.Append(v1.GetValue(x) + "<Br>");
                                }
                            }
                        }
                        result.Append("<br>------------------</bR>");
                    }

                    return result.ToString();
                }
                catch
                {
                    return string.Empty;
                }
            }

            /// <summary>
            /// 信息集合数量
            /// </summary>
            public int Count
            {
                get { return mocs.Count; }
            }

            /// <summary>
            /// 获取指定属性值,注意某些结果可能是数组。
            /// </summary>
            public object this[int index, string propertyName]
            {
                get
                {
                    try
                    {
                        string trueName = names[propertyName.Trim()]; // 以此可不区分大小写获得正确的属性名称。
                        Hashtable h = (Hashtable)mocs[index];
                        return h[trueName];
                    }
                    catch
                    {
                        return null;
                    }
                }
            }

            /// <summary>
            /// 返回所有属性名称。
            /// </summary>
            /// <param name="index"></param>
            /// <returns></returns>
            public string[] PropertyNames(int index)
            {
                try
                {
                    Hashtable h = (Hashtable)mocs[index];
                    string[] result = new string[h.Keys.Count];

                    h.Keys.CopyTo(result, 0);

                    Array.Sort(result);
                    return result;
                }
                catch
                {
                    return null;
                }
            }

            /// <summary>
            /// 构造函数
            /// </summary>
            /// <param name="path"></param>
            public WMI(string path)
            {
                names = new StringDictionary();
                mocs = new ArrayList();

                try
                {

                    ManagementClass cimobject = new ManagementClass(path);
                    ManagementObjectCollection moc = cimobject.GetInstances();

                    bool ok = false;
                    foreach (ManagementObject mo in moc)
                    {
                        Hashtable o = new Hashtable();
                        mocs.Add(o);

                        foreach (PropertyData p in mo.Properties)
                        {
                            o.Add(p.Name, p.Value);
                            if (!ok) names.Add(p.Name, p.Name);
                        }

                        ok = true;
                        mo.Dispose();
                    }
                    moc.Dispose();
                }
                catch (Exception e)
                {
                    throw new Exception(e.Message);
                }
            }

            /// <summary>
            /// 构造函数
            /// </summary>
            /// <param name="path"></param>
            public WMI(WMIPath path)
                : this(path.ToString())
            {
            }
        }
    }

    对于被接收端,您可以利用C/S的通讯模式进行控制,我用了WebServices进行了控制命令传输,当然这过程要进行安全合法验证.好了,对于上面的问题有不明白的我们共同交流,基本已经全面的交待了虚拟主机技术的实现,望大家喜欢!望您财富滚滚来

  • 相关阅读:
    今天下午去了佛山梁园——广东四大名园之一
    我眼中的Web2.0
    《花眼》观后感
    Implement SOAP services with the Zend Framework
    js 捕捉右键事件
    Zend Framework 第九节数据库操作学习总结
    PHP :time(),date(),mktime()日期与时间函数库{经常会忘却掉}
    zend_soap 实现 web service 用户验证
    php中DOMDocument简单用法(XML创建、添加、删除、修改)
    jquery 判断浏览器方法
  • 原文地址:https://www.cnblogs.com/dachie/p/1734407.html
Copyright © 2011-2022 走看看