0

I would like to detect the client operating system using ASP.NET and C#. The HttpBrowserCapabilities class lets me determine the browser information very well, like "Chrome" and version "29.0". BUT, it does not help me adequately with the operating system. The "platform" property only returns "WinNT". Well, I am using Windows 7 and obviously not the older "WinNT" so on a practical level, this does not help me.

Now, I do know that I could parse out bits of the UserAgent string manually and look for things like "Windows NT 6.1" and manually convert that to "Windows 7". I have no problem doing that for 5 or even 10 versions of Windows. BUT, I definitely do not want to write manual code for all of these conversions for EVERY operating system on the planet.

Does anyone know how I can detect the client OS from my web code without hand-writing hundreds or thousands of lines of useragent parsing? I have seen other websites show "You are using Windows 7" on their web pages. I would prefer not to buy a 3rd party object for this.

4

1 回答 1

0

您可以使用来自 UserAgentString.com 的 API

http://www.useragentstring.com/pages/api.php

于 2013-10-04T20:26:30.643 回答