Esempio n. 1
0
        /// <summary>
        /// 获取文件内容
        /// </summary>
        protected void GetData()
        {
            try
            {
                string          htmlFileName = this.VirtualPath.Replace("/Ashx/" + ShopConfig.ReadConfigInfo().TemplatePath + "/", string.Empty).Replace(".ashx", ".htm");
                SkyTemplateFile pt           = new SkyTemplateFile(fileNameDic[htmlFileName.ToLower()], "/Plugins/Template/" + ShopConfig.ReadConfigInfo().TemplatePath + "/");
                pt.InheritsNameSpace = "JWShop.Page";
                pt.NameSpace         = "JWShop.Web";

                //请求路径为手机站点时,重新设置数据来源命名空间
                string[] htmlFileNameSplit = htmlFileName.Split('/');
                if (htmlFileNameSplit.Length > 0)
                {
                    string siteName = htmlFileNameSplit[0].ToLower();
                    if (siteName == "mobile")
                    {
                        pt.InheritsNameSpace = "JWShop.Page.Mobile";
                    }
                    if (siteName == "mobileadmin")
                    {
                        pt.InheritsNameSpace = "JWShop.Page.Admin";
                    }
                }

                //解析<html:include>中包含表达式的文件

                content = pt.Process();
            }
            catch (Exception ex) {
                ResponseHelper.Redirect("/404.html");
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 绑定年份和月份
 /// </summary>
 public static void BindYearMonth(DropDownList Year, DropDownList Month)
 {
     Year.Items.Insert(0, new ListItem("请选择", ""));
     for (int i = ShopConfig.ReadConfigInfo().StartYear; i <= ShopConfig.ReadConfigInfo().EndYear; i++)
     {
         Year.Items.Add(new ListItem(i.ToString(), i.ToString()));
     }
     Month.Items.Insert(0, new ListItem("请选择", ""));
     for (int i = 1; i <= 12; i++)
     {
         Month.Items.Add(new ListItem(i.ToString(), i.ToString()));
     }
 }
Esempio n. 3
0
        /// <summary>
        /// 应用程序相关设置刷新
        /// </summary>
        public static void RefreshApp()
        {
            //地址重写
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add(".aspx", ".ashx");
            dic.Add(".html", ".ashx");
            URLRewriterModule.ReplaceFileTypeDic = dic;
            URLRewriterModule.Path         = "/Ashx/" + ShopConfig.ReadConfigInfo().TemplatePath;
            URLRewriterModule.ForbidFolder = "|/Admin/|/Admin|/Plugins/|/Install/|/Manage/|/Manage|";
            //验证码
            CheckCode.CodeDot    = ShopConfig.ReadConfigInfo().CodeDot;
            CheckCode.CodeLength = ShopConfig.ReadConfigInfo().CodeLength;
            CheckCode.CodeType   = (CodeType)ShopConfig.ReadConfigInfo().CodeType;
            CheckCode.Key        = ShopConfig.ReadConfigInfo().SecureKey;
        }
Esempio n. 4
0
        /// <summary>
        /// 获取文件名的对应关系
        /// </summary>
        private void GetRightFileName()
        {
            string cacheKey = "ShopTemplateFile";

            if (CacheHelper.Read(cacheKey) == null)
            {
                List <FileInfo> fileList = FileHelper.ListDirectory(ServerHelper.MapPath("/Plugins/Template/" + ShopConfig.ReadConfigInfo().TemplatePath + "/"), "|.htm|");
                foreach (FileInfo file in fileList)
                {
                    string tempFileName = file.FullName.Replace(ServerHelper.MapPath("\\Plugins\\Template\\" + ShopConfig.ReadConfigInfo().TemplatePath + "\\"), string.Empty).Replace("\\", "/");
                    fileNameDic.Add(tempFileName.ToLower(), tempFileName);
                }
                string          path = ServerHelper.MapPath("/Plugins/Template/" + ShopConfig.ReadConfigInfo().TemplatePath + "/");
                CacheDependency cd   = new CacheDependency(path);
                CacheHelper.Write(cacheKey, fileNameDic, cd);
            }
            else
            {
                fileNameDic = (Dictionary <string, string>)CacheHelper.Read(cacheKey);
            }
        }
Esempio n. 5
0
            /// <summary>
            /// 检查cookies
            /// </summary>
            /// <returns></returns>
            private static bool CheckCookies()
            {
                bool   flag         = false;
                string cookiesValue = CookiesHelper.ReadCookieValue(cookiesName);

                if (cookiesValue != string.Empty)
                {
                    try
                    {
                        string[] strArray     = cookiesValue.Split(new char[] { '|' });
                        string   sign         = strArray[0];
                        string   adminID      = strArray[1];
                        string   adminName    = strArray[2];
                        string   groupID      = strArray[3];
                        string   randomNumber = strArray[4];
                        if (FormsAuthentication.HashPasswordForStoringInConfigFile(adminID + adminName + groupID + randomNumber + ShopConfig.ReadConfigInfo().SecureKey + ClientHelper.Agent, "MD5").ToLower() == sign.ToLower())
                        {
                            flag = true;
                        }
                        else
                        {
                            CookiesHelper.DeleteCookie(cookiesName);
                        }
                    }
                    catch
                    {
                        CookiesHelper.DeleteCookie(cookiesName);
                    }
                }
                return(flag);
            }
Esempio n. 6
0
        /// <summary>
        /// 取得缓存依赖项
        /// </summary>
        /// <param name="virtualPath"></param>
        /// <param name="virtualPathDependencies"></param>
        /// <param name="utcStart"></param>
        /// <returns></returns>
        public override CacheDependency GetCacheDependency(string virtualPath, System.Collections.IEnumerable virtualPathDependencies, DateTime utcStart)
        {
            if (IsPathVirtual(virtualPath))
            {
                string                   path1 = ServerHelper.MapPath("/Plugins/Template/" + ShopConfig.ReadConfigInfo().TemplatePath + "/");
                CacheDependency          cd1   = new CacheDependency(path1);
                string                   path2 = ServerHelper.MapPath("/Plugins/Template/" + ShopConfig.ReadConfigInfo().TemplatePath + "/User/");
                CacheDependency          cd2   = new CacheDependency(path2);
                string                   path3 = ServerHelper.MapPath("/Plugins/Template/" + ShopConfig.ReadConfigInfo().TemplatePath + "/Mobile/");
                CacheDependency          cd3   = new CacheDependency(path3);
                string                   path4 = ServerHelper.MapPath("/Plugins/Template/" + ShopConfig.ReadConfigInfo().TemplatePath + "/Mobile/User/");
                CacheDependency          cd4   = new CacheDependency(path4);
                string                   path5 = ServerHelper.MapPath("/Plugins/Template/" + ShopConfig.ReadConfigInfo().TemplatePath + "/MobileAdmin/");
                CacheDependency          cd5   = new CacheDependency(path5);
                AggregateCacheDependency acd   = new AggregateCacheDependency();
                acd.Add(cd1);
                acd.Add(cd2);
                acd.Add(cd3);
                acd.Add(cd4);
                acd.Add(cd5);

                return(acd);
            }
            else
            {
                return(Previous.GetCacheDependency(virtualPath, virtualPathDependencies, utcStart));
            }
        }