public static UserProfile GetUser(this HttpContext context)
        {
            HttpContextDataModelCache caching = new HttpContextDataModelCache(context);
            UserProfile profile = (UserProfile)caching["userProfile"];

            //Logger.Debug("profile cache:" + (profile != null));
            if (profile == null)
            {
                if (context.User.Identity.IsAuthenticated)
                {
                    //Logger.Debug("Has Identity:" + context.User.Identity.Name);
                    profile = context.User.Identity.Name.getLoginUser();
                }
                else
                {
                    var cookie = context.Request.Cookies["loginToken"];
                    if (cookie != null && !String.IsNullOrEmpty(cookie.Value))
                    {
                        try
                        {
                            FormsAuthenticationTicket ticket = FormsAuthentication.Decrypt(cookie.Value);
                            //Logger.Debug("Has loginToken:" + ticket.Name);
                            profile = ticket.Name.getLoginUser();
                        }
                        catch (Exception ex)
                        {
                            Logger.Error(ex);
                            profile = null;
                        }
                    }
                }
                context.SetCacheValue("userProfile", profile);
            }
            return(profile);
        }
        public static void ClearCache(this HttpContext context)
        {
            HttpContextDataModelCache caching = new HttpContextDataModelCache(context);

            caching.Clear();
        }
        public static void SetCacheValue(this HttpContext context, String keyName, Object value)
        {
            HttpContextDataModelCache caching = new HttpContextDataModelCache(context);

            caching[keyName] = value;
        }