Esempio n. 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);
            }
        }
 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("...");
 }
        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("...");
            }
        }
        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);
            }
        }