Try using the ActionName filter and the custom action action selector for the mobile device. Example (copy from Pro ASP.NET MVC 2, p. 351):
- In Controller define 2 function for desktop & iPhone, they have the same ActionName [iPhone] [ActionName("Index")] public ActionResult Index_iPhone() { } [ActionName("Index")] public ActionResult Index_PC() { } - Define [iPhone] action method selector: public class iPhoneAttribute : ActionMethodSelectorAttribute { public override bool IsValidForRequest(ControllerContext controllerContext, MethodInfo methodInfo) { var userAgent = controllerContext.HttpContext.Request.UserAgent; return userAgent != null && userAgent.Contains("iPhone"); } }
source share