public IBrowsingResponse NavigatePost(Uri httpUrl, NameValueCollection postParamz)
        {
            if ((StoringFlags & StateStoringFlags.Post) == StateStoringFlags.Post)
            {
                var txt = new StringBuilder();
                txt.Append(httpUrl + ":");
                foreach (string kk in postParamz)
                {
                    txt.Append(kk + "=" + postParamz[kk] + "&");
                }
                var txtStr = txt.ToString();

                var key         = "post_" + CalculateHash(txtStr);
                var hostTrigger = RootBrowsingStateTriggers.GetOrAddChild(httpUrl.Host,
                                                                          String.Format(message, httpUrl.Host));

                var state = stateService.Get <StateBrowsingResponse>(key);
                if (state != null)
                {
                    return(state);
                }

                var response = Parent.NavigatePost(httpUrl, postParamz);

                if (ShouldCache(response))
                {
                    stateService.Put <StateBrowsingResponse>(key, StateBrowsingResponse.Create(response),
                                                             hostTrigger, (long)StoringDuration.TotalSeconds, txtStr);
                }
                return(response);
            }
            return(Parent.NavigatePost(httpUrl, postParamz));
        }
        public IBrowsingResponse NavigateFile(Uri httpUrl, List <Tuple <string, string> > filePaths, NameValueCollection postParamz)
        {
            if ((StoringFlags & StateStoringFlags.File) == StateStoringFlags.File)
            {
                var txtStr      = httpUrl + ":" + String.Join(",", filePaths);
                var key         = "file_" + CalculateHash(txtStr);
                var hostTrigger = RootBrowsingStateTriggers.GetOrAddChild(httpUrl.Host,
                                                                          String.Format(message, httpUrl.Host));
                var state = stateService.Get <StateBrowsingResponse>(key);
                if (state != null)
                {
                    return(state);
                }

                var response = Parent.NavigateFile(httpUrl, filePaths, postParamz);

                if (ShouldCache(response))
                {
                    stateService.Put <StateBrowsingResponse>(key, StateBrowsingResponse.Create(response),
                                                             hostTrigger, (long)StoringDuration.TotalSeconds, txtStr);
                }
                return(response);
            }
            return(Parent.NavigateFile(httpUrl, filePaths, postParamz));
        }
        public IBrowsingResponse NavigateGet(Uri httpUrl)
        {
            if ((StoringFlags & StateStoringFlags.Get) == StateStoringFlags.Get)
            {
                var key         = "get_" + httpUrl;
                var hostTrigger = RootBrowsingStateTriggers.GetOrAddChild(httpUrl.Host,
                                                                          String.Format(message, httpUrl.Host));
                var state = stateService.Get <StateBrowsingResponse>(key);
                if (state != null)
                {
                    return(state);
                }

                var response = Parent.NavigateGet(httpUrl);
                if (ShouldCache(response))
                {
                    stateService.Put <StateBrowsingResponse>(key, StateBrowsingResponse.Create(response),
                                                             hostTrigger, (long)StoringDuration.TotalSeconds, httpUrl.ToString());
                }
                return(response);
            }
            return(Parent.NavigateGet(httpUrl));;
        }