I\'m developing a .NET MVC3 application.
Is there a good way to detect if the user is using a mobile browser in the view (using RAZOR). I\'m wanting to differ the
I use this Method (Works fine for Me)
if (eDurar.MobileDetect.DeviceType.Any(m => Request.UserAgent.Contains(m)))
{
Layout = "~/Views/Shared/_mobileLayout.cshtml";
@Html.Partial("mobileIndex");
}
else
{
Layout = "~/Views/Shared/_Layout.cshtml";
@Html.Partial("desktopIndex");
}
I suggest you to use responsive bootstrap something, avoiding mobile specific page is better