User-707554951 posted
Hi kengkit,
In ASP.NET, you can easily detect the mobile device request using Request.Browser.IsMobileDevice property and Request.UserAgent.
string strUserAgent = Request.UserAgent.ToString().ToLower();
if (strUserAgent != null)
{
if (Request.Browser.IsMobileDevice == true || strUserAgent.Contains("iphone") ||
strUserAgent.Contains("blackberry") || strUserAgent.Contains("mobile") ||
strUserAgent.Contains("windows ce") || strUserAgent.Contains("opera mini") ||
strUserAgent.Contains("palm"))
{
Response.Redirect("DefaultMobile.aspx");
}
}
Or Use 51Degrees.mobi .NET Mobile API To Detect The User-Agent.
For more information, please refer to the following links:
https://www.codeproject.com/Articles/213825/ASP-net-Mobile-device-detection
http://www.codeguru.com/csharp/.net/net_asp/miscellaneous/article.php/c16481/Mobile-Device-Detection-and-Redirection-Using-ASPNETMVC.htm
Disclaimer: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found
on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions
you to make sure that you completely understand the risk before retrieving any software from the Internet.
Best regard
Cathy