Example #1
0
        internal HttpCapabilitiesBase EvaluateFinal(HttpRequest request, bool onlyEvaluateUserAgent)
        {
            HttpBrowserCapabilities httpBrowserCapabilities = this.BrowserCapFactory.GetHttpBrowserCapabilities(request);
            CapabilitiesState       state = new CapabilitiesState(request, httpBrowserCapabilities.Capabilities);

            if (onlyEvaluateUserAgent)
            {
                state.EvaluateOnlyUserAgent = true;
            }
            if (this._rule != null)
            {
                string str = httpBrowserCapabilities["isMobileDevice"];
                httpBrowserCapabilities.Capabilities["isMobileDevice"] = null;
                this._rule.Evaluate(state);
                string str2 = httpBrowserCapabilities["isMobileDevice"];
                if (str2 == null)
                {
                    httpBrowserCapabilities.Capabilities["isMobileDevice"] = str;
                }
                else if (str2.Equals("true"))
                {
                    httpBrowserCapabilities.DisableOptimizedCacheKey();
                }
            }
            HttpCapabilitiesBase base2 = (HttpCapabilitiesBase)HttpRuntime.CreateNonPublicInstance(this._resultType);

            base2.InitInternal(httpBrowserCapabilities);
            return(base2);
        }
        internal HttpCapabilitiesBase EvaluateFinal(HttpRequest request, bool onlyEvaluateUserAgent)
        {
            HttpBrowserCapabilities browserCaps = BrowserCapFactory.GetHttpBrowserCapabilities(request);
            CapabilitiesState       state       = new CapabilitiesState(request, browserCaps.Capabilities);

            if (onlyEvaluateUserAgent)
            {
                state.EvaluateOnlyUserAgent = true;
            }

            if (_rule != null)
            {
                string oldIsMobileDevice = browserCaps[_isMobileDeviceCapKey];
                browserCaps.Capabilities[_isMobileDeviceCapKey] = null;

                _rule.Evaluate(state);

                string newIsMobileDevice = browserCaps[_isMobileDeviceCapKey];
                if (newIsMobileDevice == null)
                {
                    browserCaps.Capabilities[_isMobileDeviceCapKey] = oldIsMobileDevice;
                }
                else if (newIsMobileDevice.Equals("true"))
                {
                    browserCaps.DisableOptimizedCacheKey();
                }
            }

            // create the new type
            //
            HttpCapabilitiesBase result = (HttpCapabilitiesBase)HttpRuntime.CreateNonPublicInstance(_resultType);

            result.InitInternal(browserCaps);

            return(result);
        }
Example #3
0
 public override void DisableOptimizedCacheKey()
 {
     _browser.DisableOptimizedCacheKey();
 }