//更新用户的cookie public static void CreateWxUser(WXUser user) { try { HttpCookie cookie = new HttpCookie(Params.UserCookieName); using (DbRepository entities = new DbRepository()) { cookie.Value = CryptoHelper.AES_Encrypt(user.ToJson(), Params.SecretKey); cookie.Expires = DateTime.Now.AddMinutes(120); } // 写登录Cookie HttpContext.Current.Response.Cookies.Remove(cookie.Name); HttpContext.Current.Response.Cookies.Add(cookie); } catch { } }
static void Main(string[] args) { var dsd = DateTime.Today; WXUser entity = new WXUser() { openid = "1112dsdsdsdsdsd", nickname = "哈哈啊查询查询", city = "福州", country = "中国", headimgurl = "http://wx.qlogo.cn/mmopen/PYEBjepVt4IW6ibsc3I8NVLN7CSIEzlsngoKK1Rka4nfUh6ia961qEUWSBTFH5OaRaf5qxpicz2bPnictCQ0fV8Sh5sLlLoVhibF9/0", province = "福建", sex = "1" }; string dd = "?info=" + HttpUtility.UrlEncode(entity.ToJson()); string ss = ""; }