public string BuildGuestID() { string guestID; if (PageCacheUtil.TryGetValue <string>("GuestID_BX", out guestID) == false) { HttpCookie cookie = CookieUtil.Get("bbxmax_guest"); if (cookie != null) { guestID = cookie.Value; } else { guestID = string.Empty; } //必须是32位长度(GUID) if (guestID == null || guestID.Length != 32) { guestID = Guid.NewGuid().ToString("N"); CookieUtil.Set("bbxmax_guest", guestID, DateTime.MaxValue); } PageCacheUtil.Set("GuestID_BX", guestID); } if (guestID == string.Empty) { return(null); } return(guestID); }