Esempio n. 1
0
 private string GetCurrPagePath(string webPath, string requestPath)
 {
   string firstPath = this.GetFirstPath(webPath, requestPath);
   if (firstPath != string.Empty && SiteDomains.GetSiteDomains().Paths.ContainsKey(firstPath))
     return firstPath;
   return string.Empty;
 }
Esempio n. 2
0
 private string GetSitePath(string webPath, string requestPath, string requestDomain)
 {
   string currDomainPath = this.GetCurrDomainPath(requestDomain);
   if (currDomainPath != string.Empty)
     return currDomainPath;
   string currPagePath = this.GetCurrPagePath(webPath, requestPath);
   if (currPagePath != string.Empty)
     return currPagePath;
   return SiteDomains.GetSiteDomains().DefaultPath;
 }
Esempio n. 3
0
        private string GetSitePath(string requestPath, string requestDomain)
        {
            if (SiteDomains.GetSiteDomains().Paths.ContainsValue(requestDomain))
            {
                return(SiteDomains.GetSiteDomains().Domains[requestDomain]);
            }
            string firstPath = this.GetFirstPath(requestPath);

            if (firstPath != string.Empty)
            {
                return(firstPath);
            }
            return(SiteDomains.GetSiteDomains().DefaultPath);
        }
Esempio n. 4
0
        private string GetLinkStartString(string requestPath, string requestDomain)
        {
            string firstPath = this.GetFirstPath(requestPath);

            if (SiteDomains.GetSiteDomains().Paths.ContainsValue(requestDomain))
            {
                return("/");
            }
            if (firstPath == string.Empty || firstPath == SiteDomains.GetSiteDomains().DefaultPath)
            {
                return(this.config.webpath);
            }
            return(this.config.webpath + firstPath + "/");
        }
Esempio n. 5
0
        public static SiteDomains GetSiteDomains()
        {
            SiteDomains siteDomains = CacheHelper.Get <SiteDomains>("dt_cache_http_domain");

            lock (SiteDomains.lockHelper)
            {
                if (siteDomains == null)
                {
                    CacheHelper.Insert("dt_cache_http_domain", (object)new SiteDomains(), 10);
                    SiteDomains.instance = CacheHelper.Get <SiteDomains>("dt_cache_http_domain");
                }
            }
            return(SiteDomains.instance);
        }
Esempio n. 6
0
        private string GetFirstPath(string requestPath)
        {
            int length = this.config.webpath.Length;

            if (requestPath.StartsWith(this.config.webpath + "aspx/"))
            {
                length = (this.config.webpath + "aspx/").Length;
            }
            string key = requestPath.Substring(length);

            if (key.IndexOf("/") > 0)
            {
                key = key.Substring(0, key.IndexOf("/"));
            }
            if (key != string.Empty && SiteDomains.GetSiteDomains().Paths.ContainsKey(key))
            {
                return(key);
            }
            return(string.Empty);
        }
Esempio n. 7
0
        public string getlink(string sitepath, string urlpath)
        {
            if (string.IsNullOrEmpty(sitepath) || string.IsNullOrEmpty(urlpath))
            {
                return(urlpath);
            }
            string lower = HttpContext.Current.Request.Url.Authority.ToLower();
            Dictionary <string, string> paths = SiteDomains.GetSiteDomains().Paths;

            if (SiteDomains.GetSiteDomains().DefaultPath == sitepath.ToLower() || paths.ContainsKey(sitepath.ToLower()) && paths.ContainsValue(lower))
            {
                return(urlpath);
            }
            int length = this.config.webpath.Length;

            if (urlpath.StartsWith(this.config.webpath))
            {
                urlpath = urlpath.Substring(length);
            }
            return(this.config.webpath + sitepath.ToLower() + "/" + urlpath);
        }
Esempio n. 8
0
        protected Rain.Model.channel_site GetSiteModel()
        {
            string sitePath = this.GetSitePath(HttpContext.Current.Request.RawUrl.ToLower(), HttpContext.Current.Request.Url.Authority.ToLower());

            return(SiteDomains.GetSiteDomains().SiteList.Find((Predicate <Rain.Model.channel_site>)(p => p.build_path == sitePath)));
        }
Esempio n. 9
0
 private string GetCurrDomainPath(string requestDomain)
 {
   if (SiteDomains.GetSiteDomains().Paths.ContainsValue(requestDomain))
     return SiteDomains.GetSiteDomains().Domains[requestDomain];
   return string.Empty;
 }