如何让网页自动跳转手机版。

2025-02-12 08:20:58
推荐回答(1个)
回答1:

使用一下语句获取浏览器
public static bool GetClientWeb()
{
bool result = false;
string clientType = string.Concat(HttpContext.Current.Request.UserAgent);
if (clientType.ToLower().Contains("mozilla") || clientType.ToLower().Contains("opera"))
{
result = true;
}
return result;
}
然后根据返回输出一个相对应的页面