Detect whether user is access website via Apple IPAD in ASP.Net

Last Reply on Apr 24, 2014 05:38 AM By Ikramshams

Posted on Apr 24, 2014 03:38 AM

In my website page there is a “Download” Button. When user is clicking on this button wallpaper is downloaded. Here Condition is that if a user is a ipad user then image is downloaded from “images/ipad/imagename” path. If a user is not a ipad user then image is downloaded from “images/originalImages/imagename” path. How can I detect that user viewing my website is a ipad user or windows  user using asp.net, c#.

Posted on Apr 24, 2014 05:38 AM

 I tried this code and this is working for me.

var userAgent = HttpContext.Current.Request.UserAgent.ToLower();
if (userAgent.Contains("ipad;"))
{
    OImgPath = "../images/ipad/" + objGet.Image3;
}
else
{
    OImgPath = "../images/OriginalImage/" + objGet.Image3;
}