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.

user2789150
  • 29
  • 1
  • 3

1 Answers1

0

You can use API from UserAgentString.com

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

Kartheek N
  • 211
  • 1
  • 8
  • Thanks for the link to the useragentstring web site but I don't want to use web service. I need my information in couple of milliseconds. So the web service will not help. Do you have any idea how this useragentstring guys are doing their stuff? – user2789150 Oct 04 '13 at 21:24
  • I can not be sure what exactly they are doing, however I expect them to maintain a database of all known UserStrings and make a DB Call to get that. Regarding your concern with not calling webservice, I couldn't think of any other way that it can be done in couple of milliseconds. Even if you write your own algorithm, it would take time to parse the string. – Kartheek N Oct 10 '13 at 20:51