/// <summary>
        /// 重写Url
        /// </summary>
        /// <param name="sender">事件的源</param>
        /// <param name="e">包含事件数据的 EventArgs</param>
        private void ReUrl_BeginRequest(object sender, EventArgs e)
        {
            BaseConfigInfo baseconfig = BaseConfigProvider.Instance();

            if (baseconfig == null)
            {
                return;
            }
            GeneralConfigInfo config       = GeneralConfigs.GetConfig();
            HttpContext       context      = ((HttpApplication)sender).Context;
            string            sysPath      = baseconfig.Syspath.ToLower();
            string            requestValue = context.Request.QueryString.ToString();
            string            requestPath  = context.Request.Path.ToString();
            // 当前样式
            string strTemplateid = "1";

            if (requestPath.ToLower().StartsWith(sysPath))
            {
                if (requestPath.ToLower().Substring(sysPath.Length).IndexOf("/") == -1)
                {
                    if (requestPath.ToLower().EndsWith("/default.aspx"))
                    {
                        CreateTemplate(sysPath, Templates.GetTemplateItem(int.Parse(strTemplateid)).Directory, "IndexPage.aspx", int.Parse(strTemplateid));

                        context.RewritePath(sysPath + "aspx/" + strTemplateid + "/IndexPage.aspx");

                        return;
                    }

                    //当使用伪aspx, 如:user-1.aspx等.
                    if (config.Aspxrewrite == 1)
                    {
                        foreach (SiteUrls.URLRewrite url in SiteUrls.GetSiteUrls().Urls)
                        {
                            if (Regex.IsMatch(requestPath, url.Pattern, Utils.GetRegexCompiledOptions() | RegexOptions.IgnoreCase))
                            {
                                string newUrl = Regex.Replace(requestPath.Substring(context.Request.Path.LastIndexOf("/")), url.Pattern, url.QueryString, Utils.GetRegexCompiledOptions() | RegexOptions.IgnoreCase);

                                //if ( url.Page.ToLower() =="/topapirecall.aspx")//淘宝回调处理
                                // {
                                //     context.RewritePath(sysPath + "Services/" + url.Page, string.Empty, newUrl + "&" + requestValue);
                                // }
                                // else
                                // {
                                context.RewritePath(sysPath + "aspx/" + strTemplateid + url.Page, string.Empty, newUrl + "&selectedtemplateid=" + strTemplateid + "&" + requestValue);
                                // }

                                return;
                            }
                        }
                    }

                    context.RewritePath(sysPath + "aspx/" + strTemplateid + requestPath.Substring(context.Request.Path.LastIndexOf("/")), string.Empty, context.Request.QueryString.ToString() + "&selectedtemplateid=" + strTemplateid);

                    return;
                }
                else if (requestPath.ToLower().StartsWith(sysPath + "home") || requestPath.ToLower().StartsWith(sysPath + "userheadimgu"))
                {
                    //当使用伪aspx, 如:user-1.aspx等.
                    if (config.Aspxrewrite == 1)
                    {
                        foreach (SiteUrls.URLRewrite url in SiteUrls.GetSiteUrls().Urls)
                        {
                            if (Regex.IsMatch(requestPath, url.Pattern, Utils.GetRegexCompiledOptions() | RegexOptions.IgnoreCase))
                            {
                                string newUrl = Regex.Replace(requestPath.Substring(context.Request.Path.LastIndexOf("/")), url.Pattern, url.QueryString, Utils.GetRegexCompiledOptions() | RegexOptions.IgnoreCase);

                                context.RewritePath(sysPath + "aspx/" + strTemplateid + url.Page, string.Empty, newUrl + "&selectedtemplateid=" + strTemplateid + "&" + requestValue);

                                return;
                            }
                        }
                    }
                    return;
                }

/*
 *              else if (requestPath.StartsWith(sysPath + "archiver/"))
 *              {
 *                  //当使用伪aspx
 *                  if (config.Aspxrewrite == 1)
 *                  {
 *                      string path = requestPath.Substring(sysPath.Length + 8);
 *                      foreach (SiteUrls.URLRewrite url in SiteUrls.GetSiteUrls().Urls)
 *                      {
 *                          if (Regex.IsMatch(path, url.Pattern, Utils.GetRegexCompiledOptions() | RegexOptions.IgnoreCase))
 *                          {
 *                              string newUrl = Regex.Replace(path, url.Pattern, url.QueryString, Utils.GetRegexCompiledOptions() | RegexOptions.IgnoreCase);
 *
 *                              context.RewritePath(sysPath + "archiver" + url.Page, string.Empty, newUrl);
 *                              return;
 *                          }
 *                      }
 *
 *                  }
 *                  return;
 *              }
 *              else if (requestPath.StartsWith(sysPath + "tools/"))
 *              {
 *                  //当使用伪aspx
 *                  if (config.Aspxrewrite == 1)
 *                  {
 *                      string path = requestPath.Substring(sysPath.Length + 5);
 *                      foreach (SiteUrls.URLRewrite url in SiteUrls.GetSiteUrls().Urls)
 *                      {
 *                          if (Regex.IsMatch(path, url.Pattern, Utils.GetRegexCompiledOptions() | RegexOptions.IgnoreCase))
 *                          {
 *                              string newUrl = Regex.Replace(path, url.Pattern, Utils.UrlDecode(url.QueryString), Utils.GetRegexCompiledOptions() | RegexOptions.IgnoreCase);
 *
 *                              context.RewritePath(sysPath + "tools" + url.Page, string.Empty, newUrl);
 *                              return;
 *                          }
 *                      }
 *                  }
 *                  return;
 *              }
 */
            }
        }