IPad Detection In ASP.Net With C#
In this programming tutorial we will learn how to detect whether request is from ipad or not in asp.net with c#. Ipad is getting popularity in market day by day due to its size and performance, so the web developer must check whether their website is working properly in ipad or not. There are certain things not working in ipad such as flash movies doesn't work in ipad, some css properties are not supported in ipad, so we have to write a code that will check whether the request is from ipad or not and then perform necessary actions. So let's have a look over the following code snippet.
if (Request.Headers["User-Agent"].ToLower().Contains("ipad"))
{
//iPad detects. Write your logic here which is specific to iPad.
}
else
{
//Normal browsers [from computers] requested.
}
OR
if(HttpContext.Current.Request.UserAgent.ToLower().Contains("ipad"))
{
//iPad detects. Write your logic here which is specific to iPad.
}
else
{
//Normal browsers [from computers] requested.
}
So that's it. It's pretty simple and need nothing to explain.
This article has been taken from Nice Tutorials