HttpContext中保存上下文使用的参数

一个是HttpContext.Current.Timestamp

一个是HttpContext.Current.Items

    public class TxnLog
    {
        const string id_key = "id_key";
        public TxnLog()
        {
            var d = HttpContext.Current.Timestamp.ToString("yyyyMMddHHmmssfffffff"); 
            object s = HttpContext.Current.Items[id_key];
            if (s == null)
            {
                d = d + "_" + helper.idq.CreateToken();
                HttpContext.Current.Items[id_key] = d;
            }
            else
            {
                d = s.ToString();
            }
            this.SN = d; 
        }
}


你可能感兴趣的:(开发技巧,ASP.NET,HttpContext)