I\'m using a C# asp.net website.
How can I check if the user using ipad or iphone? How can I check the platform?
For example, if the user enter the websi
Be careful of Windows phones! For some weird reason lots of Windows phones say "like iPhone" in the user agent. So you want to check:
public bool IsIPhone
{
get
{
if (!UserAgent.ToUpper().Contains("LIKE IPHONE"))
{
return UserAgent.ToUpper().Contains("IPHONE");
}
return false;
}
}
Example Windows phone user agent (from Lumia 735):
"Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 735) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537"