コード例 #1
0
        private T GetData <T>(string key)
        {
            if (CookieManager.Has(key))
            {
                return((T)CookieManager.Get(key));
            }

            return(default(T));
        }
コード例 #2
0
        /// <summary>
        /// Get the channel for wich the user accesed the site.
        /// </summary>
        /// <param name="filterContext"></param>
        /// <returns>The channel for wich the user accesed the site.</returns>
        private static string GetChannel(ControllerContext filterContext)
        {
            bool   isLoggedIn = filterContext.HttpContext.User.Identity.IsAuthenticated;
            string channel    = filterContext.HttpContext.Request.QueryString[qsChannel];

            if (!string.IsNullOrEmpty(channel) && !isLoggedIn)
            {
                CookieManager.Set(ckChannel, channel);
            }

            if (!isLoggedIn && CookieManager.Has(ckChannel))
            {
                channel = (string)CookieManager.Get(ckChannel);
            }
            else if (UserDataHelper.Data != null)
            {
                channel = UserDataHelper.Data.Channel;
            }

            return(channel);
        }