0

I have a website created in asp.net 3.5, c# 2008 - hosted on IIS 7. I want to check from which operating system the client is accessing the site, whether from browser of computer or from browser of tablet devices like ipad, dell streak, samsung galaxy etc or from the smart phone. Is it possible to know. I have tried out

Page.Request.Browser.Platform.ToString(); 

but accessing from android device browser I am getting it undefined.

I also have tried

Request.Browser.Capabilities["OS"].ToString();

but for android I am getting the OS name Linux !!

I want the exact name whether it is windows, Symbian, Android, iOS, MAC or Linux.

John Saunders
  • 160,644
  • 26
  • 247
  • 397
Dev
  • 6,570
  • 10
  • 66
  • 112
  • Perhaps this answer might help: http://stackoverflow.com/a/5664612/141022 – Alex KeySmith Jun 28 '12 at 12:52
  • @Alex Is it really safe to provide your request information to any third party web? – Dev Jun 28 '12 at 13:10
  • Probably not (kinda), but in a way you're sending the user agent string to Google Analytics (I'm guessing). I'm guessing that these 3rd party services / libraries work via a (probably difficult to maintain) database of user agents to the equivelant break down of os's etc. – Alex KeySmith Jun 28 '12 at 13:49
  • @Alex actually I think we should not be dependent on any third party web or service as there might be some security threats are there and also if that website gets down or something else happens there, our service also gets stopped. I need some concrete solution within my application that if any issue occurs I can control it. – Dev Jun 29 '12 at 05:14

1 Answers1

0

Try to get it from the useragent

JohnnBlade
  • 4,261
  • 1
  • 21
  • 22
  • User agent for android shows both Linux and android. Like Mozilla/5.0 (Linux; U; Android 2.2.2; en-us;....). How can I make sure that from which OS is it? – Dev Jun 28 '12 at 12:48
  • split the useragent with ";" and take the value from index 2 – JohnnBlade Jun 28 '12 at 13:00
  • Nope, It will not give you an exact answer each time. For my Android device it is giving me "U". – Dev Jun 28 '12 at 13:16
  • 1
    How about calling it android if it contains "Android", even if it also contains "Linux"? Then, just call it "Linux" if it has linux but not android? – C0deH4cker Jun 28 '12 at 22:44