Click here to Skip to main content
15,898,791 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hi,
I have a problem to getting the user's OS to my site.
I write the code as follows.
C#
System.Environment.OSVersion.ToString()

It gives the System's Os not the User's Os.

If you know about this,share the information.

Thanks In Advance
Posted
Updated 12-Jan-12 23:03pm
v2

The code you have posted will always give you the details of the machine executing the web page, not the client

If you want to view information about the client, you should use the UserAgent[^] property.

Also see here

http://msdn.microsoft.com/en-us/library/ms537503%28v=vs.85%29.aspx[^]

Obviously, it's up to the client computer what they disclose to you. They may hide certain agent settings, you can't be guaranteed consistent behaviour from this string.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 13-Jan-12 5:29am    
Agree, a 5.
--SA
You can use Request.ServerVariables Collection to find out which OS users are using.

Check here Clickty [^] for list of variables available in the collection.

HTTP_USER_AGENT is the one useful for you.
 
Share this answer
 
may be this will help you

System.Environment.OSVersion.Platform.ToString();



thanks
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 13-Jan-12 5:28am    
OP knows it much better than you do! Why confusing people? This is Server-side OS, not client-side!

Please read questions thoroughly and only answer if you are sure that you understand the matter well.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900