Classe que retorna "true" ou "false" caso o dispositivo esteja na lista de variáveis.
public class mobile : System.Web.UI.Page
{
private static string[] list = { "iphone", "nokia", "blackberry", "lg-",
"mot-", "palm", "samsung", "sec",
"android", "and", "sonyericsson", "windows ce", "opera mini",
"avantgo", "htc"
};
public bool isMobile()
{
bool bRetorno = false;
string parameter = null;
for (int i = 0; i < list.Length; i++)
{
HttpRequest Request = HttpContext.Current.Request;
parameter = Request.UserAgent;
if (!String.IsNullOrEmpty(parameter))
{
if ((parameter.ToLower().IndexOf(list[i].ToLower()) > -1))
{
bRetorno = true;
}
}
}
return bRetorno;
}
}