MarkItUp.SingleUserBlog/Common/Globals.cs

(开头部分) 8KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Web;
// using System.Web.Mail;
using System.Collections.Specialized;
using System.Globalization;
using System.Configuration;

//该源码下载自www.51aspx.com(51aspx.com)

namespace MarkItUp.SingleUserBlog.Common {
	public class Globals {
		private Globals() { }

		private static NameValueCollection ConfigSettings {
			get {

                string cacheKey = "Globals_ConfigSettings";
                NameValueCollection itemToReturn = HttpRuntime.Cache[cacheKey] as NameValueCollection;


                if (itemToReturn == null) {

                    HttpContext ctx = HttpContext.Current;
                    ctx.Trace.Write("Configuration", "Fetching data for Globals.ConfigSettings");

                    itemToReturn = ConfigurationManager.GetSection("blog/globalSettings") as NameValueCollection;

                    if (itemToReturn == null) {
                        itemToReturn = new NameValueCollection();
					}

                    DateTime cacheExpiryTime = DateTime.Now.AddSeconds(60);
                    CacheHelper.Insert(cacheKey, itemToReturn, null, cacheExpiryTime);
				}
                return itemToReturn;
			}
		}


        /// <summary>
        /// This is the folder where the indexes and other critical data is stored
        /// </summary>
        private const string defaultBlogIndexDataFolderPath = "~/App_Data";
        private static string blogIndexDataFolderPath;
        public static string BlogIndexDataFolderPath {
            get {
                if (blogIndexDataFolderPath == null) {
                    blogIndexDataFolderPath = ConfigSettings["BlogIndexDataFolderPath"] as string;

                    if (blogIndexDataFolderPath == null) {
                        blogIndexDataFolderPath = defaultBlogIndexDataFolderPath;
                    }
                }
                return HttpContext.Current.Server.MapPath(blogIndexDataFolderPath);
            }
        }
后面还有 231 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。