在.Net中判断浏览器信息
最近一个项目中使用jquery的.ajax,在IE7和FF3下没有问题,可IE6老是崩溃,“J.readyState为空或不是对象”,可能是IE6的性能问题(因为ajax的内容比较多,而且是多个ajax请求),项目时间很紧,没有时间再去单独写ajax了,于是想到从服务器端区分IE版本,如果是IE6的话直接屏蔽ajax。
下面是在.Net中判断客户端浏览器信息的相关代码。
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
string s;
HttpBrowserCapabilities bc;
bc = Request.Browser;
s = "Browser Capabilities" + "\n";
s += "Type = " + bc.Type + "\n";
s += "Name = " + bc.Browser + "\n";
s += "Version = " + bc.Version + "\n";
s += "Major Version = " + bc.MajorVersion + "\n";
s += "Minor Version = " + bc.MinorVersion + "\n";
s += "Platform = " + bc.Platform + "\n";
s += "Is Beta = " + bc.Beta + "\n";
s += "Is Crawler = " + bc.Crawler + "\n";
s += "Is AOL = " + bc.AOL + "\n";
s += "Is Win16 = " + bc.Win16 + "\n";
s += "Is Win32 = " + bc.Win32 + "\n";
s += "Supports Frames = " + bc.Frames + "\n";
s += "Supports Tables = " + bc.Tables + "\n";
s += "Supports Cookies = " + bc.Cookies + "\n";
s += "Supports VB Script = " + bc.VBScript + "\n";
s += "Supports JavaScript = " + bc.JavaScript + "\n";
s += "Supports Java Applets = " + bc.JavaApplets + "\n";
s += "Supports ActiveX Controls = " + bc.ActiveXControls + "\n";
Response.Write(s);