/// <summary> /// 从Cookie中读取ITicket信息 /// </summary> /// <returns><see cref="ITicket"/> 对象。</returns> public static ITicket LoadFromCookie() { ITicket ticket = null; Common.CheckHttpContext(); HttpRequest request = HttpContext.Current.Request; HttpCookie cookie = request.Cookies[GetLoadingCookieKey()]; if (cookie != null && cookie.Value != null && cookie.Value != string.Empty) ticket = new Ticket(Common.DecryptString(cookie.Value)); return ticket; }
protected void Page_Load(object sender, EventArgs e) { string t = Request.QueryString["t"]; if (string.IsNullOrEmpty(t)) RedirectToIntegrationPage(); else { byte[] encTicket = Convert.FromBase64String(t); StringEncryption encryption = new StringEncryption(); string ticketString = encryption.DecryptString(encTicket, PassportIntegrationSettings.GetConfig().GetDesKey()); Ticket ticket = new Ticket(ticketString); Helper.ShowTicketInfo(ticket, ticketInfo); ticketXml.InnerText = ticketString; } }