如何确定使用ASP.NET和放大器从服务器端浏览器类型; C#? [英] How to determine Browser type from Server side using ASP.NET & C#?

查看:109
本文介绍了如何确定使用ASP.NET和放大器从服务器端浏览器类型; C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用C#ASP.NET页确定code-隐藏文件浏览器的类型。

I want to determine the browser type in code-behind file using C# on ASP.NET page.

如果是 IE 6.0 ,我必须执行code的某些行。

If it is IE 6.0, I have to execute certain lines of code.

我怎么能判断浏览器类型?

How can I determine the browser type?

推荐答案

您可以使用的Request.Browser识别浏览器的信息。这些MSDN 1 &安培; 2 文章给出了更生根粉这个信息。

You can use Request.Browser to identify the browser info. These MSDN 1 & 2 article gives more info abt this.

System.Web.HttpBrowserCapabilities browser = Request.Browser;
string s = "Browser Capabilities\n"
    + "Type = "                    + browser.Type + "\n"
    + "Name = "                    + browser.Browser + "\n"
    + "Version = "                 + browser.Version + "\n"
    + "Major Version = "           + browser.MajorVersion + "\n"
    + "Minor Version = "           + browser.MinorVersion + "\n"
    + "Platform = "                + browser.Platform + "\n"
    + "Is Beta = "                 + browser.Beta + "\n"
    + "Is Crawler = "              + browser.Crawler + "\n"
    + "Is AOL = "                  + browser.AOL + "\n"
    + "Is Win16 = "                + browser.Win16 + "\n"
    + "Is Win32 = "                + browser.Win32 + "\n"
    + "Supports Frames = "         + browser.Frames + "\n"
    + "Supports Tables = "         + browser.Tables + "\n"
    + "Supports Cookies = "        + browser.Cookies + "\n"
    + "Supports VBScript = "       + browser.VBScript + "\n"
    + "Supports JavaScript = "     + 
        browser.EcmaScriptVersion.ToString() + "\n"
    + "Supports Java Applets = "   + browser.JavaApplets + "\n"
    + "Supports ActiveX Controls = " + browser.ActiveXControls 
          + "\n";

这篇关于如何确定使用ASP.NET和放大器从服务器端浏览器类型; C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆