代码语言
.
CSharp
.
JS
Java
Asp.Net
C
MSSQL
PHP
Css
PLSQL
Python
Shell
EBS
ASP
Perl
ObjC
VB.Net
VBS
MYSQL
GO
Delphi
AS
DB2
Domino
Rails
ActionScript
Scala
代码分类
文件
系统
字符串
数据库
网络相关
图形/GUI
多媒体
算法
游戏
Jquery
Extjs
Android
HTML5
菜单
网页交互
WinForm
控件
企业应用
安全与加密
脚本/批处理
开放平台
其它
【
Asp.Net
】
获取客户端的操作系统、浏览器、.NET版本等信息
作者:
Dezai.CN
/ 发布于
2011/2/28
/
564
<div><span style="color: rgb(0,0,255)">protected</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">void</span><span style="color: rgb(0,0,0)"> Page_Load(</span><span style="color: rgb(0,0,255)">object</span><span style="color: rgb(0,0,0)"> sender, EventArgs e) { </span><span style="color: rgb(0,128,0)">//</span><span style="color: rgb(0,128,0)"> 将客户端的信息添加到 Dictionary 中</span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(0,0,0)">Dictionary</span><span style="color: rgb(0,0,0)"><</span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)">></span><span style="color: rgb(0,0,0)"> clientInfos </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">new</span><span style="color: rgb(0,0,0)"> Dictionary</span><span style="color: rgb(0,0,0)"><</span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)">></span><span style="color: rgb(0,0,0)">(); </span><span style="color: rgb(0,0,255)">try</span><span style="color: rgb(0,0,0)"> { </span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)"> ip </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> Request.UserHostAddress; </span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)"> userAgent </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> Request.UserAgent </span><span style="color: rgb(0,0,0)">==</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">null</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,0)">?</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">无</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)"> : Request.UserAgent; </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)">(Request.ServerVariables[</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">HTTP_UA_CPU</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">] </span><span style="color: rgb(0,0,0)">==</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">null</span><span style="color: rgb(0,0,0)">) clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">CPU 类型</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">未知</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">CPU 类型</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, Request.ServerVariables[</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">HTTP_UA_CPU</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">]); clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">操作系统</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.GetOSNameByUserAgent(userAgent)); clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">IP 地址</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, ip); </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)">(Request.Browser.ClrVersion </span><span style="color: rgb(0,0,0)">==</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">null</span><span style="color: rgb(0,0,0)">) clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">.NET CLR 版本</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">不支持</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">.NET CLR 版本</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, Request.Browser.ClrVersion.ToString()); clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">浏览器</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, Request.Browser.Browser </span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)"> Request.Browser.Version); clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">支持 ActiveX</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, Request.Browser.ActiveXControls </span><span style="color: rgb(0,0,0)">?</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">支持</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)"> : </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">不支持</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">支持 Cookies</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, Request.Browser.Cookies </span><span style="color: rgb(0,0,0)">?</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">支持</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)"> : </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">不支持</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">支持 CSS</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, Request.Browser.SupportsCss </span><span style="color: rgb(0,0,0)">?</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">支持</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)"> : </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">不支持</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">语言</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, Request.UserLanguages[</span><span style="color: rgb(128,0,128)">0</span><span style="color: rgb(0,0,0)">]); </span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)"> httpAccept </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> Request.ServerVariables[</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">HTTP_ACCEPT</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">]; </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (httpAccept </span><span style="color: rgb(0,0,0)">==</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">null</span><span style="color: rgb(0,0,0)">) clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">计算机/手机</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">未知</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (httpAccept.IndexOf(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">wap</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">) </span><span style="color: rgb(0,0,0)">></span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,0)">-</span><span style="color: rgb(128,0,128)">1</span><span style="color: rgb(0,0,0)">) clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">计算机/手机</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">手机</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">计算机/手机</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">计算机</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Platform</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, Request.Browser.Platform); clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Win16</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, Request.Browser.Win16 </span><span style="color: rgb(0,0,0)">?</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">是</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)"> : </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">不是</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Win32</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, Request.Browser.Win32 </span><span style="color: rgb(0,0,0)">?</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">是</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)"> : </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">不是</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)">(Request.ServerVariables[</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">HTTP_ACCEPT_ENCODING</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">] </span><span style="color: rgb(0,0,0)">==</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">null</span><span style="color: rgb(0,0,0)">) clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Http Accept Encoding</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">无</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Http Accept Encoding</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, Request.ServerVariables[</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">HTTP_ACCEPT_ENCODING</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">]); clientInfos.Add(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">User Agent</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">, userAgent); } </span><span style="color: rgb(0,0,255)">catch</span><span style="color: rgb(0,0,0)"> (Exception ex) { Response.Write(ex.Message); }</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,128,0)">//</span><span style="color: rgb(0,128,0)"> 根据 Dictionary 中的内容在 Table 中显示客户端信息</span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.Response.Write(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"><table cellpadding=0 cellspacing=0></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.Response.Write(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"><tr></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.Response.Write(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"><td width=145>项目</td></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.Response.Write(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"><td>值</td></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.Response.Write(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"></tr></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">foreach</span><span style="color: rgb(0,0,0)"> (</span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)"> key </span><span style="color: rgb(0,0,255)">in</span><span style="color: rgb(0,0,0)"> clientInfos.Keys) { </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.Response.Write(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"><tr></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.Response.Write(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"><td></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)"> key </span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"></font></td></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.Response.Write(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"><td></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)"> clientInfos[key].ToString() </span><span style="color: rgb(0,0,0)">+</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"></td></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.Response.Write(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"></tr></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); } </span><span style="color: rgb(0,0,255)">this</span><span style="color: rgb(0,0,0)">.Response.Write(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)"></table></span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">); }</span></div> <div><span style="color: rgb(0,0,0)"><span style="color: rgb(128,128,128)">///</span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(128,128,128)"><summary></span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(128,128,128)">///</span><span style="color: rgb(0,128,0)"> 根据 User Agent 获取操作系统名称 </span><span style="color: rgb(128,128,128)">///</span><span style="color: rgb(0,128,0)"> </span><span style="color: rgb(128,128,128)"></summary></span><span style="color: rgb(128,128,128)"> </span><span style="color: rgb(0,0,255)">private</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)"> GetOSNameByUserAgent(</span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)"> userAgent) { </span><span style="color: rgb(0,0,255)">string</span><span style="color: rgb(0,0,0)"> osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">未知</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">NT 6.0</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Windows Vista/Server 2008</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">NT 5.2</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Windows Server 2003</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">NT 5.1</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Windows XP</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">NT 5</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Windows 2000</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">NT 4</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Windows NT4</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Me</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Windows Me</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">98</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Windows 98</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">95</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Windows 95</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Mac</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Mac</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Unix</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">UNIX</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Linux</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">Linux</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">else</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(0,0,255)">if</span><span style="color: rgb(0,0,0)"> (userAgent.Contains(</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">SunOS</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">)) { osVersion </span><span style="color: rgb(0,0,0)">=</span><span style="color: rgb(0,0,0)"> </span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(128,0,0)">SunOS</span><span style="color: rgb(128,0,0)">"</span><span style="color: rgb(0,0,0)">; } </span><span style="color: rgb(0,0,255)">return</span><span style="color: rgb(0,0,0)"> osVersion; }</span></span></div>
试试其它关键字
同语言下
.
gzip压缩
.
实现http多线程断点续传下载文件
.
实现多线程断点续传下载大文件
.
生成字符串的 CheckSum
.
根据 UserAgent 获取浏览器的类型和版本
.
根据 Agent 判断是否是智能手机
.
隐藏手机号中间四位为*方法
.
合并图片(二维码和其他图片合并)
.
ASP.NET CORE中判断是否移动端打开网页
.
ASP.NET(C#)实现页面计时(定时)自动跳转
可能有用的
.
gzip压缩
.
实现http多线程断点续传下载文件
.
实现多线程断点续传下载大文件
.
生成字符串的 CheckSum
.
根据 UserAgent 获取浏览器的类型和版本
.
根据 Agent 判断是否是智能手机
.
隐藏手机号中间四位为*方法
.
合并图片(二维码和其他图片合并)
.
ASP.NET CORE中判断是否移动端打开网页
.
ASP.NET(C#)实现页面计时(定时)自动跳转
Dezai.CN
贡献的其它代码
(
4037
)
.
多线程Socket服务器模块
.
生成随机密码
.
清除浮动样式
.
弹出窗口居中
.
抓取url的函数
.
使用base HTTP验证
.
div模拟iframe嵌入效果
.
通过header转向的方法
.
Session操作类
.
执行sqlite输入插入操作后获得自动编号的ID
Copyright © 2004 - 2024 dezai.cn. All Rights Reserved
站长博客
粤ICP备13059550号-3