ASP.NET如何获取来访者的IP、OS、浏览器及系统语言

try
        {
            string userAgent = Request.UserAgent == null ? "无" : Request.UserAgent;
            LblOS.Text=this.GetOSNameByUserAgent(userAgent);——通过下面的代码来获得用户的OS类型
            LblIP.Text = Request.UserHostAddress;   //获取IP
            LblBrs.Text = Request.Browser.Browser + Request.Browser.Version;   //获取浏览器的类型及版本号
            LblLanguage.Text = Request.UserLanguages[0];   //获取用户操作系统的语言
        }
        catch (Exception ex)
        {
            Response.Write(ex.Message);
        }

posted @ 2010-07-10 09:53  汉卿  Views(2682)  Comments(0Edit  收藏  举报