Ejemplo n.º 1
0
 public static string ReadValue(string cookieName, string propertyName)
 {
     if (CookieUtil.CookieExists(cookieName))
     {
         JObject _cookie = JObject.Parse(context.Server.UrlDecode(CookieUtil.ReadCookie(cookieName)));
         JToken  tok     = _cookie[propertyName];
         return((tok == null) || (tok.Type == JTokenType.Null) || (tok.Type == JTokenType.Undefined) || (tok.Type == JTokenType.None) ? null : _cookie[propertyName].ToString().Trim('"'));
     }
     return(null);
 }
Ejemplo n.º 2
0
        private void context_EndRequest(object sender, EventArgs e)
        {
            HttpApplication context = (HttpApplication)sender;

            if (!CookieUtil.CookieExists(Common.sessioncookie))
            {
                CookieUtil.WriteCookie(Common.sessioncookie, JsonConvert.SerializeObject(new
                {
                    id  = Common.GetHash(Guid.NewGuid().ToString()),
                    app = "hairstyle",
                    pts = new { total = 0, ids = new int[0] }
                }), false);
            }
        }
Ejemplo n.º 3
0
 public static string ReadValue(string cookieName, string propertyName, bool decrypt)
 {
     if (CookieUtil.CookieExists(cookieName))
     {
         JObject _cookie;
         if (decrypt)
         {
             string val = EncDec.Decrypt(CookieUtil.ReadCookie(cookieName), DefaultPassword);
             _cookie = JObject.Parse(val);
             JToken tok = _cookie[propertyName];
             return((tok == null) || (tok.Type == JTokenType.Null) || (tok.Type == JTokenType.Undefined) || (tok.Type == JTokenType.None) ? null : _cookie[propertyName].ToString().Trim('"'));
         }
         return(ReadValue(cookieName, propertyName));
     }
     return(null);
 }
Ejemplo n.º 4
0
 protected void Page_Load(object sender, EventArgs e)
 {
     Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
     Response.Cache.SetCacheability(HttpCacheability.NoCache);
     Response.Cache.SetNoStore();
     Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
     Common.RemoveValueinCookie(Common.InfoCookie, new string[] {
         "vuID",
         "vuemail",
         "vuname",
         "vuavatar"
     });
     if (CookieUtil.CookieExists(Common.AuthCookie))
     {
         Response.WriteFile("LoggedIn.html");
     }
     else
     {
         Response.WriteFile("home.html");
     }
     Response.End();
 }