现在的位置: 首页 > 综合 > 正文

快速取得访问者的操作系统版本、浏览器版本等信息

2012年10月18日 ⁄ 综合 ⁄ 共 503字 ⁄ 字号 评论关闭

很久没有更新我的博客了,今天上来写两句

string browser = String.Format("{0} {1}",HttpContext.Current.Request.Browser.Browser,HttpContext.Current.Request.Browser.Version);
    string platform = HttpContext.Current.Request.Browser.Platform;

    if (HttpContext.Current.Request.UserAgent != null)
    {
     if(HttpContext.Current.Request.UserAgent.IndexOf("Windows NT 5.2")>=0)
      platform = "Win2003";
    }
    this.lbl_Browser.Text = browser;
    this.lbl_Platform.Text = platform;
    this.lbl_Ip.Text = HttpContext.Current.Request.UserHostAddress;

抱歉!评论已关闭.