检测操作系统是否为Windows [英] Detect Whether the Operating system is windows

查看:79
本文介绍了检测操作系统是否为Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮我找到代码以确定操作系统是否使用request.useragent属性?

Can anyone help me in finding the code to determine whether the Operating system is Windows using request.useragent property?

推荐答案

喜欢这个? (基于线程此处 [ ^ ])



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

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
}





另外,我很好奇为什么要这样做。为什么您使用哪个操作系统进行Web应用程序是否重要?



Plus, I am curious why would you do that. Why should it matter which operating system are you using for a web application?


尝试使用此链接......

http://stackoverflow.com/questions/2819934/detect-windows-7-in-net [<一个href =http://stackoverflow.com/questions/2819934/detect-windows-7-in-nettarget =_ blanktitle =新窗口> ^ ]
try with this link......
http://stackoverflow.com/questions/2819934/detect-windows-7-in-net[^]


这篇关于检测操作系统是否为Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆