asp.net 判断是手机或电脑访问网页的方式
string osPat = "mozilla|m3gate|winwap|openwave|Windows NT|Windows 3.1|95|Blackcomb|98|ME|X Window|Longhorn|ubuntu|AIX|Linux|AmigaOS|BEOS|HP-UX|OpenBSD|FreeBSD|NetBSD|OS/2|OSF1|SUN"; string uAgent = Request.ServerVariables["HTTP_USER_AGENT"]; Regex reg = new Regex(osPat); if (reg.IsMatch(uAgent)) { Response.Write("电脑访问"); } else { Response.Write("手机访问"); }