如何用asp.net检测操作系统 [英] How can i detect operation system with asp.net

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

问题描述

我有一个网站,我被用于Flash应用程序。这个Flash应用程序没有出现在iPad和IPhone.if操作系统Ipad或Iphone我想显示javascript application.i'm使用下面的代码,但这个代码只获取平台Win32NT等信息。

i have a web site and i was used flash application.This flash applications not appear on IPad and IPhone.if operation system Ipad or Iphone i want to shown javascript application.i'm using below code but this code getting only platform information such as Win32NT.

OperatingSystem os = Environment.OSVersion;
os.Platform.ToString();


推荐答案

使用 Request.UserAgent 。那会给你你需要的东西。请注意,UserAgent可能会返回错误的信息,因为浏览器可以允许您更改此信息。

同时退房本文检测ASP.NET中的移动浏览器

Use Request.UserAgent. That will give you what you need. Please not that UserAgent may return a wrong information as browser can allow you to change this.
Also check out this article Detecting a mobile browser in ASP.NET

 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
        }

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

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