C#服务器端获取用户设备信息
2018-04-01 19:33
661 查看
C#服务器使用Request.UserAgent
使用语言:C#
环境:.net Framework 4.6.1 (当前使用) MVC4 (貌似支持所有NetWeb环境,我就不多说了)
使用语言:C#
环境:.net Framework 4.6.1 (当前使用) MVC4 (貌似支持所有NetWeb环境,我就不多说了)
using System; using System.Web.Mvc; namespace ServerMonitoring.Controllers { public class HomeController : Controller { public ActionResult Index() { String userAgent; userAgent = Request.UserAgent; bool _windows = userAgent.Contains("Windows NT"), 4000 _mac = userAgent.Contains("Macintosh"), _iphone = userAgent.Contains("iPhone"), _android = userAgent.Contains("Android") ; if (_windows) { Response.Write("您的平台可能是win!微软系统:windows"); } else if (_mac) { Response.Write("您的平台可能是Mac!苹果系统:Mac"); } else if (_iphone) { Response.Write("您的平台可能是Iphone!苹果系统:Ios"); } else if (_android) { Response.Write("您的平台可能是Android!安卓系统:Android"); } else { Response.Write("未能识别您的系统"); } return View(); } } }
相关文章推荐
- Windows Phone 7获取用户信息和设备信息
- UWP 应用获取各类系统、用户信息 (1) - 设备和系统的基本信息、应用包信息、用户数据账户信息和用户账户信息
- C#微信小程序服务端获取用户解密信息
- C#获取用户基本信息一(关注了公众号的用户)
- 浅谈.NET(C#)与Windows用户账户信息的获取
- (C#)与Windows用户账户信息的获取
- C#获取AD用户信息
- C#使用Xamarin开发可移植移动应用终章(11.获取设备信息与常用组件,开源一个可开发模版.)
- c# 获取移动硬盘信息、监听移动设备的弹出与插入事件
- c# 获取移动硬盘信息、监听移动设备的弹出与插入事件
- C#获取AD用户信息
- C#微信小程序服务端获取用户解密信息
- C# 调用LDAP接口获取域用户信息
- java以及C#获取AD域上用户信息
- C#获取客户端及服务器端主机信息
- 用c#开发微信(2)扫描二维码,用户授权后获取用户基本信息 (源码下载)
- C#微信小程序服务端获取用户解密信息实例代码
- 用C#获取MOSS中当前登录用户的信息
- C#获取自己电脑相关设备信息
- C# 获取 域(AD) 用户信息