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

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

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;

posted @ 2006-09-22 17:39  老蒋  阅读(690)  评论(0编辑  收藏  举报