zoukankan      html  css  js  c++  java
  • HttpBrowserCapabilities使用获取浏览器信息

    using System;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;

    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            HttpBrowserCapabilities hbcMyBrower = new HttpBrowserCapabilities();
            hbcMyBrower = Request.Browser;

            //测试浏览器类型
            Response.Write("浏览器类型是:" + hbcMyBrower.Type);

            Response.Write("<br>");
            Response.Write("浏览器是否是AOL浏览器:" + hbcMyBrower.AOL);

            Response.Write("<br>");
            Response.Write("浏览器是否能语音呼叫:" + hbcMyBrower.CanInitiateVoiceCall);

            Response.Write("<br>");
            Response.Write("浏览器是否支持HTML播放背景音乐:" + hbcMyBrower.BackgroundSounds);

            Response.Write("<br>");
            Response.Write("浏览器是否是测试版:" + hbcMyBrower.Beta);


            Response.Write("<br>");
            Response.Write("浏览器是否支持多个卡片组:" + hbcMyBrower.CanCombineFormsInDeck);
            //测试浏览器是否支持ActiveX
            Response.Write("<br>");
            Response.Write("浏览器是否支持ActiveX控件:" + hbcMyBrower.ActiveXControls);

            Response.Write("<br>");
            Response.Write("支持用http获取XML吗?:" + hbcMyBrower.SupportsXmlHttp);

            Response.Write("<br>");
            Response.Write("浏览器是否支持Cookies:" + hbcMyBrower.Cookies);

            Response.Write("<br>");
            Response.Write("浏览器是否是Web爬行遍历搜索引擎:" + hbcMyBrower.Crawler);

            Response.Write("<br>");
            Response.Write("浏览器一个窗口所允许的提交按钮个数:" + hbcMyBrower.DefaultSubmitButtonLimit);

            Response.Write("<br>");
            Response.Write("浏览器ECMAScript版本号:" + hbcMyBrower.EcmaScriptVersion);

            Response.Write("<br>");
            Response.Write("获取.NET安装版本:" + hbcMyBrower.ClrVersion);

           // Response.Write("<br>");
            //Response.Write("获取.NET所有安装版本:" + hbcMyBrower.GetClrVersions);

            Response.Write("<br>");
            Response.Write("浏览器是否具有专用的上一步按钮:" + hbcMyBrower.HasBackButton);

            Response.Write("<br>");
            Response.Write("浏览器内部标识号:" + hbcMyBrower.Id);

            Response.Write("<br>");
            Response.Write("浏览器支持的输入类型:" + hbcMyBrower.InputType);

            Response.Write("<br>");
            Response.Write("浏览器是否具有颜色显示:" + hbcMyBrower.IsColor);

            Response.Write("<br>");
            Response.Write("浏览器是否支持JAVA:" + hbcMyBrower.JavaApplets);

            Response.Write("<br>");
            Response.Write("浏览器是否支持JAVAScript:" + hbcMyBrower.JavaScript);

            Response.Write("<br>");
            Response.Write("浏览器的整个版本号:" + hbcMyBrower.Version);
        }
    }

  • 相关阅读:
    精灵点点基础教程1 -- 下载与安装
    技术人员搞公司还是省省吧
    企业级自定义表单引擎解决方案(二)--架构及核心模块设计
    企业级自定义表单引擎解决方案(一)--总体介绍
    .net core quartz job作业调度管理组件
    NPOI读写Excel组件封装Excel导入导出组件
    企业级工作流解决方案(十七)--工作流--工作流插件模型
    企业级工作流解决方案(十六)--工作流--工作流实体模型
    企业级工作流解决方案(十五)--集成Abp和ng-alain--Abp其他改造
    企业级工作流解决方案(十四)--集成Abp和ng-alain--自动化脚本
  • 原文地址:https://www.cnblogs.com/forever4444/p/1521419.html
Copyright © 2011-2022 走看看