我们怎么知道客户的操作系统 [英] How can we know os of the client

查看:60
本文介绍了我们怎么知道客户的操作系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望c#中的代码知道当我提供客户端的IP地址时客户端使用哪种类型的操作系统。就像他使用Windows 7一样,它将返回Windows 7,否则,如果他使用Linux,它将返回Linux系统。那些客户端已经连接到我的路由器。



我尝试过:



  protected   void  Page_Load( object  sender,EventArgs e)

{

HttpBrowserCapabilities browse = Request.Browser;

Response.Write( 您的浏览器名称: + browse.Browser );

Response.Write( < br>);

Response.Write( 您的浏览器版本: + browse.Version );

Response.Write( < br>);

Response.Write( 您的操作系统: + browse.Platform );



}

解决方案

您可以获得平台属性。

它为XP以上的所有Windows操作系统返回WinNT。

但是......你可以使用 HttpRequest.UserAgent属性(的System.Web) [ ^ ]去解决问题:了解用户代理字符串(Internet Explorer) [ ^ ](Windows 10返回Windows NT 10.0作为用户代理字符串的一部分,MS不要在那里提到)

您无法提供IP地址来获取操作系统,您需要连接到远程浏览器,必须由用户启动。

I want code in c# to know which type of os is client using when I give ip address of the client. like if he using windows 7 it will return windows 7 or else if he is using Linux it will return Linux system . And those client's are already connected to my router.

What I have tried:

protected void Page_Load(object sender, EventArgs e)

    {

        HttpBrowserCapabilities browse = Request.Browser;

        Response.Write("Your Browser name: " + browse.Browser);

        Response.Write("<br>");

        Response.Write("Your Browser version: " + browse.Version);

        Response.Write("<br>");

        Response.Write("Your Operating System: " + browse.Platform);

        

    }

解决方案

The Platform property is all you get.
And it returns WinNT for all Windows OSes above XP.
But...you can use the HttpRequest.UserAgent Property (System.Web)[^] to work it out: Understanding user-agent strings (Internet Explorer)[^] (Windows 10 returns "Windows NT 10.0" as part of the user agent string, which MS don't mention there)
You can't "give an IP address" to get the OS, you need a connection to the remote browser, which has to be user initiated.


这篇关于我们怎么知道客户的操作系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆