コード例 #1
0
        /// <summary>
        /// Checks URL specified at CloudVeil.CompileSecrets.ConnectivityCheck + "/ncsi.txt" for connectivity.
        /// </summary>
        /// <remarks>
        /// Windows 7 captive portal detection isn't perfect. Somehow in my testing, it got disabled on my test network.
        ///
        /// Granted, a restart may fix it, but we're not going to ask our customers to do that in order to get their computer working on a captive portal.
        /// </remarks>
        /// <returns>true if captive portal.</returns>
        private CaptivePortalDetected checkCaptivePortalState()
        {
            if (NetworkStatus.Default.BehindIPv4CaptivePortal || NetworkStatus.Default.BehindIPv6CaptivePortal)
            {
                return(CaptivePortalDetected.Yes);
            }

            // "Oh, you want to depend on Windows captive portal detection? Haha nope!" -- Boingo Wi-FI
            // Some captive portals indeed let msftncsi.com through and thoroughly break windows captive portal detection.
            // BWI airport wifi is one of them.
            switch (ConnectivityCheck.IsAccessible())
            {
            case ConnectivityCheck.Accessible.No: return(CaptivePortalDetected.NoResponseReturned);

            case ConnectivityCheck.Accessible.Yes: return(CaptivePortalDetected.No);

            case ConnectivityCheck.Accessible.UnexpectedResponse: return(CaptivePortalDetected.Yes);

            default: return(CaptivePortalDetected.No);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: radtek/Filter-Windows
 static int connectivityCheck()
 {
     return((int)ConnectivityCheck.IsAccessible());
 }