DetectSmartphone() public method

public DetectSmartphone ( ) : bool
return bool
        public override string GetVaryByCustomString(HttpContext context, string custom)
        {
            if (custom.ToLower() == "url")
            {
                return "url=" + context.Request.Url.AbsoluteUri;
            }

            if (custom.ToLower() == "url;device")
            {
                var mobileDetection = new MobileDetection(System.Web.HttpContext.Current);
                var isSmartphone = mobileDetection.DetectSmartphone();
                return "url=" + context.Request.Url.AbsoluteUri + "&isSmartphone=" + isSmartphone;
            }

            return base.GetVaryByCustomString(context, custom);
        }
Beispiel #2
0
        public override string GetVaryByCustomString(HttpContext context, string custom)
        {
            if (custom.ToLower() == "url")
            {
                return("url=" + context.Request.Url.AbsoluteUri);
            }

            if (custom.ToLower() == "url;device")
            {
                var mobileDetection = new MobileDetection(System.Web.HttpContext.Current);
                var isSmartphone    = mobileDetection.DetectSmartphone();
                return("url=" + context.Request.Url.AbsoluteUri + "&isSmartphone=" + isSmartphone);
            }

            return(base.GetVaryByCustomString(context, custom));
        }