protected void mobileRedirect()
{
string userAgent = Request.UserAgent;
bool isPC = true;
string[] Agents = new string[] { "Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod" };
for (int i = 0; i < Agents.Length; i++)
{
if (userAgent.IndexOf(Agents[i]) > -1)
{
isPC = false;
}
}
if (!isPC)
{
Response.Redirect("/wap/index_mo.html");
}
}
该方法能检测出所有的移动设备吗?
http://alzhai.com/post-603.html
User-Agent一般都是用来检测移动设备的。你需要有一个映射表关系来知道是什么移动设备