Exemple #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);
 }
Exemple #2
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1));
     context.Response.Cache.SetCacheability(HttpCacheability.NoCache);
     context.Response.Cache.SetNoStore();
     if (CookieUtil.CookieExists(Common.AuthCookie))
     {
         context.Response.WriteFile("LoggedIn.html", true);
     }
     else
     {
         context.Response.WriteFile("home.html", true);
     }
 }
Exemple #3
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 = "EyeShadow",
                    pts = new { total = 0, ids = new int[0] }
                }), false);
            }
        }
Exemple #4
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);
 }
Exemple #5
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();
 }