Request.Servervariables(“HTTP_USER_AGENT“)是什么意思。
时间:2009-08-21 13:13:00
UserAgent = Trim(Lcase(Request.Servervariables("HTTP_USER_AGENT")))
If InStr(UserAgent,"teleport") > 0 or InStr(UserAgent,"webzip") > 0 or InStr(UserAgent,"flashget")>0 or InStr(UserAgent,"offline")>0 Then
Response.Write "请不要采用teleport/Webzip/Flashget/Offline等工具来浏览论坛!"
Response.End
End If
1、Request.Servervariables("HTTP_USER_AGENT")是什么意思。
2、lcase起什么作用。
3、InStr这个是什么意思。
lcase是转化为小写吧?
在一个字符串中找另一个字符串出现的位置
1、Request.Servervariables("HTTP_USER_AGENT")是什么意思。
在ASP中使用如下语句可以得到访问者的http_user_agent字符串。
Dim StrUserAgent
StrUserAgent=Request.ServerVariables("HTTP_USER_AGENT")
这个字符串一般是如下格式:
Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)
上面的字符串可以说明访问者使用的操作系统是Windows98,浏览器是MSIE 4.01,但是这个字符串格式不固定,而且可以自己更改。
平常我们所见的其它一些主要的UserAgent字符串如下:
使用IE的浏览器:
Mozilla/2.0 (compatible; MSIE 3.01; Windows 95)
Mozilla/4.0 (compatible; MSIE 4.0; Windows 95);
Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)
Mozilla/4.0 (compatible; MSIE 5.0; Windows 98);
Mozilla/4.0 (compatible; MSIE 5.0b2; Windows NT)
使用NetScape的浏览器:
Mozilla/4.03 〔en〕 (Win95; I)
Mozilla/4.08 〔en〕 (WinNT; U ;Nav)
Mozilla/4.5 〔en〕 (WinNT; U)
Mozilla/3.04Gold (Win95; I)
使用Opera的浏览器:
Mozilla/4.0 (compatible; Opera/3.0; Windows 95) 3.50b10
FrontPage编辑器:
Mozilla/2.0 (compatible; MS FrontPage 3.0)
使用Sun操作系统:
Mozilla/3.01Gold (X11; I; SunOS 5.7 i86pc)
使用PowerPc的Mac机:
Mozilla/4.0 (compatible; MSIE 4.5; Mac_PowerPC)
通过分析以上字符串,我们可以找出规律,编写一个子程序来判断访问者用的是何种操作系统,又由于用ASP中的判断浏览器类型的控件需要更新Browser.ini文件,所以我们可以结合这个字符串来判断浏览器属性。
2、lcase起什么作用。
将字符串转为小写的函数。
3、InStr这个是什么意思。
一个字符串处理的函数。
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Mysql环境变量配置方式
![](https://img.aspxhome.com/file/2023/8/122918_0s.png)
java实现的连接oracle/mysql数据库功能简单示例【附oracle+mysql数据库驱动包】
myFocus 一个KindEditor的焦点图插件
![](https://img.aspxhome.com/file/2023/3/71293_0s.jpg)
JavaScript中call,apply,bind的区别与实现
![](https://img.aspxhome.com/file/2023/1/136021_0s.png)
asp连接access数据库表代码实例
Python 图片文字识别的实现之PaddleOCR
![](https://img.aspxhome.com/file/2023/8/90498_0s.png)
python getpass实现密文实例详解
![](https://img.aspxhome.com/file/2023/0/90820_0s.png)
Python3之外部文件调用Django程序操作model等文件实现方式
Dreamweaver实现flash透明背景
一文带你吃透Python中的os和sys模块
![](https://img.aspxhome.com/file/2023/0/76010_0s.png)
asp如何通过表单创建一个Word?
python 进阶学习之python装饰器小结
![](https://img.aspxhome.com/file/2023/3/75863_0s.jpg)
利用MySQL主从配置实现读写分离减轻数据库压力
![](https://img.aspxhome.com/file/2023/9/70389_0s.png)
Python中的数据可视化matplotlib与绘图库模块
![](https://img.aspxhome.com/file/2023/1/101161_0s.png)
详解使用pymysql在python中对mysql的增删改查操作(综合)
![](https://img.aspxhome.com/file/2023/3/120993_0s.jpg)
支持多风格变换的ASP分页类
SQL Server SQL Agent服务使用教程小结
Python自动化办公之Word文件内容的读取
![](https://img.aspxhome.com/file/2023/7/131287_0s.jpg)