For checking this use the following code
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Browser.IsMobileDevice == true ||
Request.UserAgent.ToLower().Contains("iphone"))
{
Response.Redirect("DefaultIPhone.aspx");
}
}
The UserAgent property contains the data which tells from which device the request is coming. On problem with this approach is that there are lot of mobile devices and browsers which runs on mobile. One solution I found for this problem is by using a library called 51degrees.mobi.
No comments:
Post a Comment