Microsoft.Web.Administration.Helper.IsRunningOnMono C# (CSharp) Method

IsRunningOnMono() static private method

static private IsRunningOnMono ( ) : bool
return bool
        internal static bool IsRunningOnMono()
        {
            return Type.GetType("Mono.Runtime") != null;
        }

Usage Example

Example #1
0
        private void Initialize()
        {
            if (_initialized)
            {
                return;
            }

            _initialized = true;
            if (!CanBrowse)
            {
                _host     = string.Empty;
                _endPoint = null;
                return;
            }

            var value = (string)this["bindingInformation"];
            var last  = value.LastIndexOf(':');

            if (last > -1)
            {
                _host = value.Substring(last + 1);
                var next = value.LastIndexOf(':', last - 1);
                var port = value.Substring(next + 1, last - next - 1);
                if (next > -1)
                {
                    var address = value.Substring(0, next);
                    _endPoint = new IPEndPoint(address.DisplayToAddress(), Int32.Parse(port));
                }
            }

            if (Protocol != "https" || CertificateHash != null)
            {
                return;
            }

            if (Helper.IsRunningOnMono())
            {
                // TODO: how to do it on Mono?
                return;
            }

            if (Parent.Parent.Server.SupportsSni)
            {
                if (this.GetIsSni())
                {
                    var sni = NativeMethods.QuerySslSniInfo(new Tuple <string, int>(_host, _endPoint.Port));
                    if (sni != null)
                    {
                        CertificateHash      = sni.Hash;
                        CertificateStoreName = sni.StoreName;
                        SslFlags             = SslFlags.Sni;
                        return;
                    }
                }
            }

            var certificate = NativeMethods.QuerySslCertificateInfo(_endPoint);

            if (certificate != null)
            {
                CertificateHash      = certificate.Hash;
                CertificateStoreName = certificate.StoreName;
            }
        }
All Usage Examples Of Microsoft.Web.Administration.Helper::IsRunningOnMono