zoukankan      html  css  js  c++  java
  • 检测是否安装了 .NET Framework 3.5

    此脚本是为 Internet Explorer 设计的。    其他浏览器可能在 UserAgent 字符串中不包含 .NET CLR 信息。

    <HTML>
      <HEAD>
        <TITLE>Test for the .NET Framework 3.5</TITLE>
        <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8" />
        <SCRIPT LANGUAGE="JavaScript">
        <!--
        var dotNETRuntimeVersion = "3.5.0.0";
        
        function window::onload()
        {
          if (HasRuntimeVersion(dotNETRuntimeVersion))
          {
            result.innerText = 
              "This machine has the correct version of the .NET Framework 3.5."
          } 
          else
          {
            result.innerText = 
              "This machine does not have the correct version of the .NET Framework 3.5." +
              " The required version is v" + dotNETRuntimeVersion + ".";
          }
          result.innerText += "
    
    This machine's userAgent string is: " + 
            navigator.userAgent + ".";
        }
        
        //
        // Retrieve the version from the user agent string and 
        // compare with the specified version.
        //
        function HasRuntimeVersion(versionToCheck)
        {
          var userAgentString = 
            navigator.userAgent.match(/.NET CLR [0-9.]+/g);
    
          if (userAgentString != null)
          {
            var i;
    
            for (i = 0; i < userAgentString.length; ++i)
            {
              if (CompareVersions(GetVersion(versionToCheck), 
                GetVersion(userAgentString[i])) <= 0)
                return true;
            }
          }
    
          return false;
        }
    
        //
        // Extract the numeric part of the version string.
        //
        function GetVersion(versionString)
        {
          var numericString = 
            versionString.match(/([0-9]+).([0-9]+).([0-9]+)/i);
          return numericString.slice(1);
        }
    
        //
        // Compare the 2 version strings by converting them to numeric format.
        //
        function CompareVersions(version1, version2)
        {
          for (i = 0; i < version1.length; ++i)
          {
            var number1 = new Number(version1[i]);
            var number2 = new Number(version2[i]);
    
            if (number1 < number2)
              return -1;
    
            if (number1 > number2)
              return 1;
          }
    
          return 0;
        }
        
        -->
        </SCRIPT>
      </HEAD>
      
      <BODY>
        <div id="result" />
      </BODY>
    </HTML>
    

    如果搜索“.NET CLR”版本成功,将显示以下类型的状态消息:

    This machine has the correct version of the .NET Framework 3.5.

    This machine's userAgent string is: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.0.590; .NET CLR 3.5.20726; MS-RTC LM 8).

    否则,显示以下类型的状态消息:

    This machine does not have the correct version of the .NET Framework 3.5.  The required version is v3.5.0.0. 

    This machine's userAgent string is: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; SLCC1; .NET CLR 2.0.50727; .NET CLR 1.1.4322; InfoPath.2; .NET CLR 3.0.590; MS-RTC LM 8).

    转自:http://technet.microsoft.com/zh-cn/bb909885(v=vs.85).aspx

  • 相关阅读:
    监控视频长度压缩算法
    获取客户端IP
    常用API接口签名验证参考
    .NET发布的程序代码防止反编译
    SQL Server 获取日期时间并格式化
    SQL Server2008R2可疑状态恢复
    限制网站报错信息暴露在外(客户端可以查看到)
    发布网站时线上网站务必把debug设置false
    IIS上的项目网站关闭Http请求中的Trace和OPTIONS
    使用uploadify上传大文件报 IO error #2038错误的解决方案
  • 原文地址:https://www.cnblogs.com/niaomingjian/p/3773214.html
Copyright © 2011-2022 走看看