Пример #1
0
        private static Canary15Cookie TryCreateFromHttpCookie(HttpCookie cookie, string logonUniqueKey, Canary15Profile profile)
        {
            string   text   = null;
            Canary15 canary = null;

            if (cookie == null)
            {
                ExTraceGlobals.CoreTracer.TraceDebug <string>(21L, "Http cookie is null, Name={0}", profile.Name);
            }
            else if (string.IsNullOrEmpty(cookie.Value))
            {
                ExTraceGlobals.CoreTracer.TraceDebug <string, string, string>(21L, "Http cookie value is null, Name={0}, Domain={1}, Path={2}", cookie.Name, cookie.Domain, cookie.Path);
            }
            else if (!Canary15Cookie.TryGetCookieValue(cookie.Value, out text))
            {
                ExTraceGlobals.CoreTracer.TraceDebug(21L, "TryParseCookeValue failed, Name={0}, Domain={1}, Path={2}, Value={3}", new object[]
                {
                    cookie.Name,
                    cookie.Domain,
                    cookie.Path,
                    cookie.Value
                });
            }
            else
            {
                canary = Canary15.RestoreCanary15(text, logonUniqueKey);
            }
            if (canary == null)
            {
                if (cookie != null)
                {
                    ExTraceGlobals.CoreTracer.TraceDebug(21L, "restoredCanary==null, Name={0}, Domain={1}, Path={2}, Value={3}, canaryString={4}, logonUniqueKey={5}", new object[]
                    {
                        cookie.Name,
                        cookie.Domain,
                        cookie.Path,
                        cookie.Value,
                        text,
                        logonUniqueKey
                    });
                }
                canary = new Canary15(logonUniqueKey);
                ExTraceGlobals.CoreTracer.TraceDebug <string, string, string>(21L, "Canary is recreated, userContextId={0}, logonUniqueKey={1}, canaryString={2}", canary.UserContextId, canary.LogonUniqueKey, canary.ToString());
            }
            return(Canary15Cookie.Create(canary, profile));
        }
Пример #2
0
        public static Canary15Cookie TryCreateFromHttpContext(HttpContext httpContext, string logOnUniqueKey, Canary15Profile profile)
        {
            HttpCookie cookie = httpContext.Request.Cookies.Get(profile.Name);

            return(Canary15Cookie.TryCreateFromHttpCookie(cookie, logOnUniqueKey, profile));
        }