コード例 #1
0
        void context_BeginRequest(object sender, EventArgs e)
        {
            var httpContext = HttpContext.Current;

            if (!httpContext.Request.Url.AbsolutePath.Contains(".aspx"))
            {
                return;
            }
            if (IsNoThanksCookieSet())
            {
                return;
            }
            if (OnMobileInterstitial())
            {
                return;
            }
            if (ComingFromMobileInterstitial())
            {
                return;
            }

            var mobileDetect = new MobileDetect(httpContext);

            if (mobileDetect.IsMobile())
            {
                var url        = httpContext.Request.RawUrl;
                var encodedUrl = HttpUtility.UrlEncode(url);
                httpContext.Response.Redirect("MobileInterstitial.aspx?returnUrl=" + encodedUrl);
            }
        }
コード例 #2
0
 void btnDownload_Click(object sender, EventArgs e)
 {
     var mobileDetect = new MobileDetect(Context);
     if (mobileDetect.IsAndroid())
         Response.Redirect("market://search?q=pname:com.myappname.android");
     if (mobileDetect.IsApple())
         Response.Redirect("http://itunes.com/apps/appname");
     if (mobileDetect.IsWindowsPhone())
         Response.Redirect("...");
 }
コード例 #3
0
        void btnDownload_Click(object sender, EventArgs e)
        {
            var mobileDetect = new MobileDetect(Context);

            if (mobileDetect.IsAndroid())
            {
                Response.Redirect("market://search?q=pname:com.myappname.android");
            }
            if (mobileDetect.IsApple())
            {
                Response.Redirect("http://itunes.com/apps/appname");
            }
            if (mobileDetect.IsWindowsPhone())
            {
                Response.Redirect("...");
            }
        }
コード例 #4
0
        void context_BeginRequest(object sender, EventArgs e)
        {
            var httpContext = HttpContext.Current;
            if (!httpContext.Request.Url.AbsolutePath.Contains(".aspx"))
                return;
            if (IsNoThanksCookieSet())
                return;
            if (OnMobileInterstitial())
                return;
            if (ComingFromMobileInterstitial())
                return;

            var mobileDetect = new MobileDetect(httpContext);
            if (mobileDetect.IsMobile())
            {
                var url = httpContext.Request.RawUrl;
                var encodedUrl = HttpUtility.UrlEncode(url);
                httpContext.Response.Redirect("MobileInterstitial.aspx?returnUrl=" + encodedUrl);
            }
        }