Mobile Device:
Request.Browser["IsMobileDevice"] == "true";
BlackBerry:
Request.Browser["BlackBerry"] == "true" ;
iphone:
Request.UserAgent.ToLower().Contains("iphone");
Sample c# code:
if (Request.Headers["User-Agent"] != null && (Request.Browser["IsMobileDevice"] == "true" || Request.Browser["BlackBerry"] == "true" || Request.UserAgent.ToUpper().Contains("MIDP") || Request.UserAgent.ToUpper().Contains("CLDC")) || Request.UserAgent.ToLower().Contains("iphone"))
{
Response.Redirect("www.google.com");
}
1 comment:
Grateful to check out your website, I seem to be ahead to more excellent sites and I wish that you wrote more informative post for us. Well done work.
Post a Comment