Click here to Skip to main content
15,893,668 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Can anyone help me in finding the code to determine whether the Operating system is Windows using request.useragent property?
Posted

Like this? (based on thread here[^])

C#
if(Request.UserAgent.IndexOf("Windows NT 5.1") > 0)
{
//xp
}
else if (Request.UserAgent.IndexOf("Windows NT 6.0") > 0)
{
//VISTA
}
else if (Request.UserAgent.IndexOf("Windows NT 6.1") > 0)
{
//7
}
else if (Request.UserAgent.IndexOf("Windows NT 6.3") > 0)
{
//8.1
}


Plus, I am curious why would you do that. Why should it matter which operating system are you using for a web application?
 
Share this answer
 
v4
Comments
user 3008 12-Jun-15 6:49am    
we create a website where we can download few pdf files. This download will not be supported in the MAC operating system. Thus we want to display a warning message in the download only if the operating system not windows. In order to do this we need to acquire the environment operating system.
 
Share this answer
 

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