惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
V
Visual Studio Blog
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
爱范儿
爱范儿
Vercel News
Vercel News
博客园 - 聂微东
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
W
WeLiveSecurity
B
Blog RSS Feed
P
Privacy International News Feed
Latest news
Latest news
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Hacker News
The Hacker News
人人都是产品经理
人人都是产品经理
D
Docker
Blog — PlanetScale
Blog — PlanetScale
C
Cisco Blogs
T
Threatpost
aimingoo的专栏
aimingoo的专栏
C
Cybersecurity and Infrastructure Security Agency CISA
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
有赞技术团队
有赞技术团队
L
Lohrmann on Cybersecurity
F
Full Disclosure
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
Stack Overflow Blog
Stack Overflow Blog
月光博客
月光博客
博客园 - 【当耐特】
T
Threat Research - Cisco Blogs
Security Latest
Security Latest
雷峰网
雷峰网
T
Tor Project blog
Cisco Talos Blog
Cisco Talos Blog
Spread Privacy
Spread Privacy
K
Kaspersky official blog
I
Intezer
The Register - Security
The Register - Security
宝玉的分享
宝玉的分享
P
Proofpoint News Feed
P
Privacy & Cybersecurity Law Blog
Simon Willison's Weblog
Simon Willison's Weblog
腾讯CDC
U
Unit 42
T
Tenable Blog
IT之家
IT之家
NISL@THU
NISL@THU

博客园 - kingboy

miniSipServer简单而不简单,轻松落地,实现电脑对固话、手机通讯 sql 去重 C#防止WebBrowser在新窗口中打开链接页面 常用sql语句 sql 复制表 获得 DataSet中的记录总数 MySQL安装的图解 sql 按日期查询 C#中的日期函数使用大全 火车座位分布图 javascript页面跳转常用代码 首页头部下拉广告设计(javascript) GridView 自定义分页 GridView加ObjectDataSource做删除事件(ObjectDataSourceStatusEventHandler 委托) GridView日期格式模版列使用方法 (转) 非常酷的三级下拉菜单!!(javascript) JavaScript 强行弹出窗口 与 无提示关闭页面 sql事务处理(转) o(∩_∩)o...哈哈 在博客园安家了!!
C# 获取客户端信息 /asp.net/WebService/WebForm
kingboy · 2013-08-18 · via 博客园 - kingboy

Request.Browser.MajorVersion.ToString();//获取客户端浏览器的(主)版本号
Request.Browser.Version.ToString();   //获取客户端浏览器的完整版本号
Request.Browser.Platform.ToString();  //获取客户端使用平台的名字
Request.UserHostAddress.ToString();   //获取远程客户端主机IP
HttpRequest.Url.ToString();           //获取有关当前请求的URL的信息。  
HttpRequest.UrlReferrer.ToString();   //获取有关客户端上次请求的URL的信息,该请求链接到当前的    URL。  
HttpRequest.UserAgent.ToString();       //获取客户端浏览器的原始用户代理信息。  
HttpRequest.UserHostAddress.ToString(); //获取远程客户端的IP主机地址。  
HttpRequest.UserHostName.ToString();    //获取远程客户端的DNS名称。  
HttpRequest.UserLanguages.ToString();   //获取客户端语言首选项的排序字符串数组。
 
 
 
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.JavaScript + "\n"
       + "Supports Java Applets = "    + browser.JavaApplets + "\n"
       + "Supports ActiveX Controls = " + browser.ActiveXControls + "\n";
    TextBox1.Text = s;
 
//////////////////////////////////////////////////////////////////////////////////////
在.NET中,WebService和WebForm页面
 
Web Service使用(通过HttpContext对象调用Request对象):
HttpContext.Current.Request.UserHostAddress
HttpContext.Current.Request.ServerVariables.GetValues("REMOTE_ADDR")[0]
Web Form使用(可直接使用Request对象):
Request.ServerVariables.GetValues("REMOTE_ADDR")[0]
HttpContext.Current.Request.UserHostAddress

posted @ 2013-08-18 18:37  kingboy  阅读(4381)  评论()    收藏  举报