protected void Page_Load(object sender, EventArgs e) { base.AllowHttpMethod("POST"); string Rtn = ""; UserVM user = AuthServer.GetLoginUser(); if (user == null) { return; } if (user.MenuJson != null && user.MenuJson.Trim().Length == 0 == false) { Rtn = user.MenuJson; } else { Rtn = user.MenuJson; user.MenuJson = Rtn; AuthServer.SetLoginUser(user); } Response.ContentType = "application/json; charset=utf-8"; Response.Write(Rtn); Response.End(); //string json = JsonConvert.SerializeObject(rtn); //byte[] bytes = Encoding.UTF8.GetBytes(json); //string base64 = Convert.ToBase64String(bytes); //Response.ContentType = "text/plain; charset=utf-8"; //Response.Write(base64); //GZippedJsonT gzip = new GZippedJsonT(); //Response.BinaryWrite(gzip.Compress(JsonConvert.SerializeObject(rtn))); //MemoryStream ms = new MemoryStream(); //using (BsonWriter writer = new BsonWriter(ms)) //{ // JsonSerializer serializer = new JsonSerializer(); // serializer.Serialize(writer, new { x="x", y="y", z="z" }); //} ////Response.Write(ms.ToArray()); //string data = Convert.ToBase64String(ms.ToArray()); //byte[] data2 = Convert.FromBase64String(data); //MemoryStream ms2 = new MemoryStream(data2); //object xx; //using (BsonReader reader = new BsonReader(ms2)) //{ // JsonSerializer serializer = new JsonSerializer(); // xx = serializer.Deserialize(reader); //} //Response.Write(data); //Response.End(); }
protected void Page_Load(object sender, EventArgs e) { base.AllowHttpMethod("GET"); base.DisableTop(false); base.BodyClass = "class='leftblock'"; UserVM user = AuthServer.GetLoginUser(); if (user == null) { return; } if (WebConfigurationManager.AppSettings["HasCacheMenu"] == null || Convert.ToBoolean(WebConfigurationManager.AppSettings["HasCacheMenu"]) == false) { MyTreeData = GetMenu(user); } else { if (user.MenuJson != null && user.MenuJson.Trim().Equals("") == false) { MyTreeData = user.MenuJson; } else { MyTreeData = GetMenu(user); user.MenuJson = MyTreeData; AuthServer.SetLoginUser(user); } } string encryptedJsonString = Request["o"] ?? ""; string decryptedJsonString = QueryStringEncryptToolS.Decrypt(encryptedJsonString); HomeUrlVM VM = JsonConvert.DeserializeObject <HomeUrlVM>(decryptedJsonString); string HomeUrlValidPeriodMinute = WebConfigurationManager.AppSettings["HomeUrlValidPeriodMinute"]; int minute = 0; int.TryParse(HomeUrlValidPeriodMinute, out minute); if (VM != null && VM.date != null && DateTime.Compare(DateTime.Now.Add(TimeSpan.FromMinutes(minute)), VM.date) >= 0) { if (VM.PageUrl.Equals("") == false) { PageUrl = VM.PageUrl; } } //Response.ContentType = "application/json; charset=utf-8"; //Response.Write(Rtn); //Response.End(); }