Ejemplo n.º 1
0
        /// <summary>
        /// 根据站点目录和已生成的链接重新组合(实际访问页面用到)
        /// </summary>
        /// <param name="sitepath">站点目录</param>
        /// <param name="urlpath">URL链接</param>
        /// <returns>String</returns>
        public string getlink(string sitepath, string urlpath)
        {
            if (string.IsNullOrEmpty(sitepath) || string.IsNullOrEmpty(urlpath))
            {
                return(urlpath);
            }
            string requestDomain            = HttpContext.Current.Request.Url.Authority.ToLower(); //获取来源域名含端口号
            Dictionary <string, string> dic = SiteDomains.GetSiteDomains().Paths;                  //获取站点键值对

            //如果当前站点为默认站点则直接返回
            if (SiteDomains.GetSiteDomains().DefaultPath == sitepath.ToLower())
            {
                return(urlpath);
            }
            //如果当前域名存在于域名列表则直接返回
            if (dic.ContainsKey(sitepath.ToLower()) && dic.ContainsValue(requestDomain))
            {
                return(urlpath);
            }
            int indexNum = config.webpath.Length; //安装目录长度

            if (urlpath.StartsWith(config.webpath))
            {
                urlpath = urlpath.Substring(indexNum);
            }
            //安装目录+站点目录+URL
            return(config.webpath + sitepath.ToLower() + "/" + urlpath);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 获取当前域名包含的站点目录
 /// </summary>
 /// <param name="requestDomain">获取的域名(含端口号)</param>
 /// <returns>String</returns>
 private string GetCurrDomainPath(string requestDomain)
 {
     //当前域名是否存在于站点目录列表
     if (SiteDomains.GetSiteDomains().Paths.ContainsValue(requestDomain))
     {
         return(SiteDomains.GetSiteDomains().Domains[requestDomain]);
     }
     return(string.Empty);
 }
Ejemplo n.º 3
0
 /// <summary>
 /// 获取绑定域名的频道分类目录名
 /// </summary>
 /// <param name="webPath">网站安装目录</param>
 /// <param name="requestPath">当前页面,包含目录</param>
 /// <param name="requestDomain">当前的域名(含端口号)</param>
 /// <returns>String</returns>
 private string GetDomainPath(string webPath, string requestPath, string requestDomain)
 {
     //获取绑定域名的目录
     if (SiteDomains.GetSiteDomains().CategoryDirs.ContainsValue(requestDomain))
     {
         return(SiteDomains.GetSiteDomains().Domains[requestDomain]);
     }
     return(string.Empty);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// 返回站点信息
        /// </summary>
        protected Model.channel_site GetSiteModel()
        {
            string requestDomain = HttpContext.Current.Request.Url.Authority.ToLower(); //获得来源域名含端口号
            string requestPath   = HttpContext.Current.Request.RawUrl.ToLower();        //当前的URL地址
            string sitePath      = GetSitePath(requestPath, requestDomain);

            Model.channel_site modelt = SiteDomains.GetSiteDomains().SiteList.Find(p => p.build_path == sitePath);
            return(modelt);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取当前页面包含的站点目录
        /// </summary>
        /// <param name="webPath">网站安装目录</param>
        /// <param name="requestPath">获取的页面,包含目录</param>
        /// <returns>String</returns>
        private string GetCurrPagePath(string webPath, string requestPath)
        {
            //获取URL的虚拟目录(除安装目录)
            string requestFirstPath = GetFirstPath(webPath, requestPath);

            if (requestFirstPath != string.Empty && SiteDomains.GetSiteDomains().Paths.ContainsKey(requestFirstPath))
            {
                return(requestFirstPath);
            }
            return(string.Empty);
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 返回域名字典
        /// </summary>
        public static SiteDomains GetSiteDomains()
        {
            SiteDomains _cache = CacheHelper.Get <SiteDomains>(DTKeys.CACHE_SITE_HTTP_DOMAIN);

            lock (lockHelper)
            {
                if (_cache == null)
                {
                    CacheHelper.Insert(DTKeys.CACHE_SITE_HTTP_DOMAIN, new SiteDomains(), 10);
                    instance = CacheHelper.Get <SiteDomains>(DTKeys.CACHE_SITE_HTTP_DOMAIN);
                }
            }
            return(instance);
        }
Ejemplo n.º 7
0
 /// <summary>
 /// 获取当前域名包含的站点目录
 /// </summary>
 /// <param name="requestDomain">获取的域名(含端口号)</param>
 /// <returns>String</returns>
 private string GetCurrDomainPath(string requestDomain)
 {
     //当前域名是否存在于站点目录列表
     if (SiteDomains.GetSiteDomains().Paths.ContainsValue(requestDomain))
     {
         string sitePath = SiteDomains.GetSiteDomains().Domains[requestDomain];
         //如果存在,检查是否默认站点,是则还需检查虚拟目录部分
         if (sitePath != SiteDomains.GetSiteDomains().DefaultPath)
         {
             return(sitePath);
         }
     }
     return(string.Empty);
 }
Ejemplo n.º 8
0
        /// <summary>
        /// 获取站点的目录
        /// </summary>
        /// <param name="requestPath">获取的页面,包含目录</param>
        /// <param name="requestDomain">获取的域名(含端口号)</param>
        /// <returns>String</returns>
        private string GetSitePath(string requestPath, string requestDomain)
        {
            //当前域名是否存在于站点目录列表
            if (SiteDomains.GetSiteDomains().Paths.ContainsValue(requestDomain))
            {
                return(SiteDomains.GetSiteDomains().Domains[requestDomain]);
            }

            // 获取当前页面包含的站点目录
            string pagePath = GetFirstPath(requestPath);

            if (pagePath != string.Empty)
            {
                return(pagePath);
            }
            return(SiteDomains.GetSiteDomains().DefaultPath);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// 获取站点的目录
        /// </summary>
        /// <param name="webPath">网站安装目录</param>
        /// <param name="requestPath">获取的页面,包含目录</param>
        /// <param name="requestDomain">获取的域名(含端口号)</param>
        /// <returns>String</returns>
        private string GetSitePath(string webPath, string requestPath, string requestDomain)
        {
            //获取当前域名包含的站点目录
            string domainPath = GetCurrDomainPath(requestDomain);

            if (domainPath != string.Empty)
            {
                return(domainPath);
            }
            // 获取当前页面包含的站点目录
            string pagePath = GetCurrPagePath(webPath, requestPath);

            if (pagePath != string.Empty)
            {
                return(pagePath);
            }
            return(SiteDomains.GetSiteDomains().DefaultPath);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// 获取链接的前缀
        /// </summary>
        /// <param name="requestPath">当前的URL地址</param>
        /// <param name="requestDomain">获得来源域名含端口号</param>
        /// <returns>String</returns>
        private string GetLinkStartString(string requestPath, string requestDomain)
        {
            string requestFirstPath = GetFirstPath(requestPath);//获得二级目录(不含站点安装目录)

            //检查是否与绑定的域名或者与默认站点的目录匹配
            if (SiteDomains.GetSiteDomains().Paths.ContainsValue(requestDomain))
            {
                return("/");
            }
            else if (requestFirstPath == string.Empty || requestFirstPath == SiteDomains.GetSiteDomains().DefaultPath)
            {
                return(config.webpath);
            }
            else
            {
                return(config.webpath + requestFirstPath + "/");
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 获取当前页面包含的站点目录
        /// </summary>
        private string GetFirstPath(string requestPath)
        {
            int indexNum = config.webpath.Length; //安装目录长度

            //如果包含安装目录和aspx目录也要过滤掉
            if (requestPath.StartsWith(config.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/"))
            {
                indexNum = (config.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/").Length;
            }
            string requestFirstPath = requestPath.Substring(indexNum);

            if (requestFirstPath.IndexOf("/") > 0)
            {
                requestFirstPath = requestFirstPath.Substring(0, requestFirstPath.IndexOf("/"));
            }
            if (requestFirstPath != string.Empty && SiteDomains.GetSiteDomains().Paths.ContainsKey(requestFirstPath))
            {
                return(requestFirstPath);
            }
            return(string.Empty);
        }
Ejemplo n.º 12
0
        /// <summary>
        /// 获取访问的频道分类目录(不含安装目录)
        /// </summary>
        private string GetFirstPath()
        {
            //string requestPath = HttpContext.Current.Request.CurrentExecutionFilePath.ToLower();//获得当前页面虚拟路径
            string requestPath = HttpContext.Current.Request.RawUrl.ToLower();
            int    indexNum    = config.webpath.Length; //安装目录长度

            //如果包含安装目录和aspx目录也要过滤掉
            if (requestPath.StartsWith(config.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/"))
            {
                indexNum = (config.webpath + DTKeys.DIRECTORY_REWRITE_ASPX + "/").Length;
            }
            string requestFirstPath = requestPath.Substring(indexNum);

            if (requestFirstPath.IndexOf("/") > 0)
            {
                requestFirstPath = requestFirstPath.Substring(0, requestFirstPath.IndexOf("/"));
            }
            if (requestFirstPath != string.Empty && SiteDomains.GetSiteDomains().CategoryDirs.ContainsKey(requestFirstPath))
            {
                return(requestFirstPath);
            }
            return(string.Empty);
        }
Ejemplo n.º 13
0
 /// <summary>
 /// 返回域名字典
 /// </summary>
 public static SiteDomains GetSiteDomains()
 {
     SiteDomains _cache = CacheHelper.Get<SiteDomains>(DTKeys.CACHE_SITE_HTTP_DOMAIN);
     lock (lockHelper)
     {
         if (_cache == null)
         {
             CacheHelper.Insert(DTKeys.CACHE_SITE_HTTP_DOMAIN, new SiteDomains(), 10);
             instance = CacheHelper.Get<SiteDomains>(DTKeys.CACHE_SITE_HTTP_DOMAIN);
         }
     }
     return instance;
 }
Ejemplo n.º 14
0
        /// <summary>
        /// 返回URL重写统一链接地址
        /// </summary>
        public string linkurl(string _key, params object[] _params)
        {
            Hashtable ht = new BLL.url_rewrite().GetList();          //获得URL配置列表

            Model.url_rewrite model = ht[_key] as Model.url_rewrite; //查找指定的URL配置节点

            //如果不存在该节点则返回空字符串
            if (model == null)
            {
                return(string.Empty);
            }

            string requestDomain    = HttpContext.Current.Request.Url.Authority.ToLower(); //获得来源域名含端口号
            string requestFirstPath = GetFirstPath();                                      //获得二级目录(不含站点安装目录)
            string linkStartString  = string.Empty;                                        //链接前缀

            //检查是否与绑定的域名或者与默认频道分类的目录匹配
            if (SiteDomains.GetSiteDomains().CategoryDirs.ContainsValue(requestDomain))
            {
                linkStartString = "/";
            }

            else if (requestFirstPath == string.Empty || requestFirstPath == SiteDomains.GetSiteDomains().DefaultPath)
            {
                linkStartString = config.webpath;
            }
            else
            {
                linkStartString = config.webpath + requestFirstPath + "/";
            }
            //如果URL字典表达式不需要重写则直接返回
            if (model.url_rewrite_items.Count == 0)
            {
                //检查网站重写状态
                if (config.staticstatus > 0)
                {
                    if (_params.Length > 0)
                    {
                        return(linkStartString + GetUrlExtension(model.page, config.staticextension) + string.Format("{0}", _params));
                    }
                    else
                    {
                        return(linkStartString + GetUrlExtension(model.page, config.staticextension));
                    }
                }
                else
                {
                    if (_params.Length > 0)
                    {
                        return(linkStartString + model.page + string.Format("{0}", _params));
                    }
                    else
                    {
                        return(linkStartString + model.page);
                    }
                }
            }
            //否则检查该URL配置节点下的子节点
            foreach (Model.url_rewrite_item item in model.url_rewrite_items)
            {
                //如果参数个数匹配
                if (IsUrlMatch(item, _params))
                {
                    //检查网站重写状态
                    if (config.staticstatus > 0)
                    {
                        return(linkStartString + string.Format(GetUrlExtension(item.path, config.staticextension), _params));
                    }
                    else
                    {
                        string queryString = Regex.Replace(string.Format(item.path, _params), item.pattern, item.querystring, RegexOptions.None | RegexOptions.IgnoreCase);
                        if (queryString.Length > 0)
                        {
                            queryString = "?" + queryString;
                        }
                        return(linkStartString + model.page + queryString);
                    }
                }
            }

            return(string.Empty);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 页面请求事件处理
        /// </summary>
        /// <param name="sender">事件的源</param>
        /// <param name="e">包含事件数据的 EventArgs</param>
        private void ReUrl_BeginRequest(object sender, EventArgs e)
        {
            HttpContext context = ((HttpApplication)sender).Context;

            Model.siteconfig siteConfig  = new BLL.siteconfig().loadConfig(); //获得站点配置信息
            string           requestPath = context.Request.Path.ToLower();    //获得当前页面(含目录)

            //如果虚拟目录(不含安装目录)与站点根目录名相同则不需要重写
            if (IsDirExist(DTKeys.CACHE_SITE_DIRECTORY, siteConfig.webpath, siteConfig.webpath, requestPath))
            {
                return;
            }

            string requestDomain = context.Request.Url.Authority.ToLower();                     //获得当前域名(含端口号)
            string sitePath      = GetSitePath(siteConfig.webpath, requestPath, requestDomain); //获取当前站点目录
            string requestPage   = CutStringPath(siteConfig.webpath, sitePath, requestPath);    //截取除安装、站点目录部分

            //检查网站重写状态0表示不开启重写、1开启重写、2生成静态
            if (siteConfig.staticstatus == 0)
            {
                #region 站点不开启重写处理方法===========================
                //遍历URL字典,匹配URL页面部分
                foreach (Model.url_rewrite model in SiteUrls.GetUrls().Urls)
                {
                    //查找到与页面部分匹配的节点
                    if (model.page == requestPath.Substring(requestPath.LastIndexOf("/") + 1))
                    {
                        //如果该页面属于插件页则映射到插件目录,否则映射到站点目录
                        if (model.type == DTKeys.DIRECTORY_REWRITE_PLUGIN)
                        {
                            context.RewritePath(string.Format("{0}{1}/{2}{3}",
                                                              siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, DTKeys.DIRECTORY_REWRITE_PLUGIN, requestPage));
                            return;
                        }
                        else
                        {
                            context.RewritePath(string.Format("{0}{1}/{2}{3}",
                                                              siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, sitePath, requestPage));
                            return;
                        }
                    }
                }
                #endregion
            }
            else
            {
                #region 站点开启重写或静态处理方法=======================
                //遍历URL字典
                foreach (Model.url_rewrite model in SiteUrls.GetUrls().Urls)
                {
                    //如果没有重写表达式则不需要重写
                    if (model.url_rewrite_items.Count == 0 &&
                        Utils.GetUrlExtension(model.page, siteConfig.staticextension) == requestPath.Substring(requestPath.LastIndexOf("/") + 1))
                    {
                        //如果该页面属于插件页则映射到插件目录,否则映射到站点目录
                        if (model.type == DTKeys.DIRECTORY_REWRITE_PLUGIN)
                        {
                            context.RewritePath(string.Format("{0}{1}/{2}/{3}",
                                                              siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, DTKeys.DIRECTORY_REWRITE_PLUGIN, model.page));
                            return;
                        }
                        else
                        {
                            context.RewritePath(string.Format("{0}{1}/{2}/{3}",
                                                              siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, sitePath, model.page));
                            return;
                        }
                    }
                    //遍历URL字典的子节点
                    foreach (Model.url_rewrite_item item in model.url_rewrite_items)
                    {
                        string newPattern = Utils.GetUrlExtension(item.pattern, siteConfig.staticextension); //替换扩展名

                        //如果与URL节点匹配则重写
                        if (Regex.IsMatch(requestPage, string.Format("^/{0}$", newPattern), RegexOptions.None | RegexOptions.IgnoreCase) ||
                            (model.page == "index.aspx" && Regex.IsMatch(requestPage, string.Format("^/{0}$", item.pattern), RegexOptions.None | RegexOptions.IgnoreCase)))
                        {
                            //如果开启生成静态、不是移动站点且是频道页或首页,则映射重写到HTML目录
                            if (siteConfig.staticstatus == 2 && !SiteDomains.GetSiteDomains().MobilePaths.Contains(sitePath) &&
                                (model.channel.Length > 0 || model.page.ToLower() == "index.aspx")) //频道页
                            {
                                context.RewritePath(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_HTML + "/" + sitePath +
                                                    Utils.GetUrlExtension(requestPage, siteConfig.staticextension, true));
                                return;
                            }
                            else if (model.type == DTKeys.DIRECTORY_REWRITE_PLUGIN) //插件页
                            {
                                string queryString = Regex.Replace(requestPage, string.Format("/{0}", newPattern), item.querystring, RegexOptions.None | RegexOptions.IgnoreCase);
                                context.RewritePath(string.Format("{0}{1}/{2}/{3}",
                                                                  siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, DTKeys.DIRECTORY_REWRITE_PLUGIN, model.page), string.Empty, queryString);
                                return;
                            }
                            else //其它
                            {
                                string queryString = Regex.Replace(requestPage, string.Format("/{0}", newPattern), item.querystring, RegexOptions.None | RegexOptions.IgnoreCase);
                                context.RewritePath(string.Format("{0}{1}/{2}/{3}",
                                                                  siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, sitePath, model.page), string.Empty, queryString);
                                return;
                            }
                        }
                    }
                }
                #endregion
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 页面请求事件处理
        /// </summary>
        /// <param name="sender">事件的源</param>
        /// <param name="e">包含事件数据的 EventArgs</param>
        private void ReUrl_BeginRequest(object sender, EventArgs e)
        {
            HttpContext context       = ((HttpApplication)sender).Context;
            string      requestDomain = context.Request.Url.Authority.ToLower(); //获得当前域名(含端口号)
            string      requestPath   = context.Request.Path.ToLower();          //获得当前页面(含目录)

            Model.siteconfig siteConfig = new BLL.siteconfig().loadConfig();     //获得站点配置信息

            //如果虚拟目录(不含安装目录)与站点根目录名相同则不需要重写
            if (IsDirExist(DTKeys.CACHE_SITE_DIRECTORY, siteConfig.webpath, siteConfig.webpath, requestPath))
            {
                return;
            }

            //检查网站重写状态0表示不开启重写、1开启重写、2生成静态
            if (siteConfig.staticstatus == 0)
            {
                #region 站点不开启重写处理方法=======================================
                //遍历URL字典,匹配URL页面部分
                foreach (Model.url_rewrite model in SiteUrls.GetSiteUrls().Urls)
                {
                    //查找到与页面部分匹配的节点
                    if (model.page == requestPath.Substring(requestPath.LastIndexOf("/") + 1))
                    {
                        //如果该页面属于插件页则映射到插件目录,否则映射到频道分类目录
                        if (model.type == DTKeys.DIRECTORY_REWRITE_PLUGIN)
                        {
                            context.RewritePath(string.Format("{0}{1}/{2}{3}",
                                                              siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, DTKeys.DIRECTORY_REWRITE_PLUGIN, requestPath));
                            return;
                        }
                        else
                        {
                            ////默认的频道目录
                            string defaultPath = SiteDomains.GetSiteDomains().DefaultPath;
                            //获取绑定域名的频道分类目录
                            string domainPath = GetDomainPath(siteConfig.webpath, requestPath, requestDomain);
                            //获取虚拟目录的频道分类目录
                            string categoryPath = GetCategoryPath(siteConfig.webpath, requestPath, requestDomain);
                            if (domainPath != string.Empty)
                            {
                                defaultPath = domainPath;
                            }
                            else if (categoryPath != string.Empty)
                            {
                                defaultPath = categoryPath;
                            }

                            context.RewritePath(string.Format("{0}{1}/{2}{3}",
                                                              siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, defaultPath, requestPath));
                            return;
                        }
                    }
                }
                #endregion
            }
            else
            {
                #region 站点开启重写或静态处理方法===================================
                ////默认的频道目录
                string defaultPath = SiteDomains.GetSiteDomains().DefaultPath;
                //获取绑定域名的频道分类目录
                string domainPath = GetDomainPath(siteConfig.webpath, requestPath, requestDomain);
                //获取虚拟目录的频道分类目录
                string categoryPath = GetCategoryPath(siteConfig.webpath, requestPath, requestDomain);

                //遍历URL字典
                foreach (Model.url_rewrite model in SiteUrls.GetSiteUrls().Urls)
                {
                    //如果没有重写表达式则不需要重写
                    if (model.url_rewrite_items.Count == 0 &&
                        Utils.GetUrlExtension(model.page, siteConfig.staticextension) == requestPath.Substring(requestPath.LastIndexOf("/") + 1))
                    {
                        //如果该页面属于插件页则映射到插件目录,否则映射到频道分类目录
                        if (model.type == DTKeys.DIRECTORY_REWRITE_PLUGIN)
                        {
                            context.RewritePath(string.Format("{0}{1}/{2}/{3}",
                                                              siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, DTKeys.DIRECTORY_REWRITE_PLUGIN, model.page));
                            return;
                        }
                        else
                        {
                            if (domainPath != string.Empty)
                            {
                                defaultPath = domainPath; //如果是绑定的域名访问则将对应的目录赋值
                            }
                            else if (categoryPath != string.Empty)
                            {
                                defaultPath = categoryPath; //如果是虚拟目录访问则将对应的目录赋值
                            }
                            context.RewritePath(string.Format("{0}{1}/{2}/{3}", siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, defaultPath, model.page));
                            return;
                        }
                    }
                    //遍历URL字典的子节点
                    foreach (Model.url_rewrite_item item in model.url_rewrite_items)
                    {
                        if (domainPath != string.Empty)
                        {
                            defaultPath = domainPath; //如果是绑定的域名访问则将对应的目录赋值
                        }
                        else if (categoryPath != string.Empty)
                        {
                            defaultPath = categoryPath; //如果是虚拟目录访问则将对应的目录赋值
                        }
                        string patternPath = siteConfig.webpath;
                        if (domainPath == string.Empty && categoryPath != string.Empty)
                        {
                            patternPath += categoryPath + "/";
                        }
                        string newPattern = Utils.GetUrlExtension(item.pattern, siteConfig.staticextension); //替换扩展名

                        //如果与URL节点匹配则重写
                        if (Regex.IsMatch(requestPath, string.Format("^{0}{1}$", patternPath, newPattern), RegexOptions.None | RegexOptions.IgnoreCase) ||
                            (model.page == "index.aspx" && Regex.IsMatch(requestPath, string.Format("^{0}{1}$", patternPath, item.pattern), RegexOptions.None | RegexOptions.IgnoreCase)))
                        {
                            //如果开启生成静态、不是手机网站且是频道页或首页,则映射重写到HTML目录
                            if (siteConfig.staticstatus == 2 && defaultPath != DTKeys.DIRECTORY_REWRITE_MOBILE &&
                                (model.channel.Length > 0 || model.page.ToLower() == "index.aspx")) //频道页
                            {
                                if (domainPath == string.Empty && categoryPath != string.Empty)
                                {
                                    context.RewritePath(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_HTML + Utils.GetUrlExtension(requestPath, siteConfig.staticextension, true));
                                }
                                else
                                {
                                    context.RewritePath(siteConfig.webpath + DTKeys.DIRECTORY_REWRITE_HTML + "/" + defaultPath + Utils.GetUrlExtension(requestPath, siteConfig.staticextension, true));
                                }
                                return;
                            }
                            else if (model.type == DTKeys.DIRECTORY_REWRITE_PLUGIN) //插件页
                            {
                                string queryString = Regex.Replace(requestPath, string.Format("{0}{1}", patternPath, newPattern),
                                                                   item.querystring, RegexOptions.None | RegexOptions.IgnoreCase);
                                context.RewritePath(string.Format("{0}{1}/{2}/{3}", siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, DTKeys.DIRECTORY_REWRITE_PLUGIN, model.page),
                                                    string.Empty, queryString);
                                return;
                            }
                            else //其它
                            {
                                string queryString = Regex.Replace(requestPath, string.Format("{0}{1}", patternPath, newPattern),
                                                                   item.querystring, RegexOptions.None | RegexOptions.IgnoreCase);
                                context.RewritePath(string.Format("{0}{1}/{2}/{3}",
                                                                  siteConfig.webpath, DTKeys.DIRECTORY_REWRITE_ASPX, defaultPath, model.page), string.Empty, queryString);
                                return;
                            }
                        }
                    }
                }
                #endregion
            }
        }