Format ASP.Net MVC app for desktop and mobile browser

前端 未结 3 1005
猫巷女王i
猫巷女王i 2021-02-04 19:56

I am working on an ASP.Net MVC application that with views that I want to be able to format for desktop browsers as well as mobile browsers. Both formats would use the same Con

相关标签:
3条回答
  • 2021-02-04 20:20

    I would detect the browser in the controller and return the appropriate view. I guess you could override the view engine but that really seems like overkill to the extreme.

    0 讨论(0)
  • 2021-02-04 20:22

    ScottHa has this post about targeting multiple devices with ASP.NET MVC addressing that same problem.

    I would suggest either in the view or in something between the controller and the view (the ViewEngine...)

    0 讨论(0)
  • 2021-02-04 20:22

    I'd go with custom attributes stuffing appropriate views/masterpages around the returned Model. We use this tactic heavily for Ajaxification, shouldn't be difficult to extend the concept to mobile.

    0 讨论(0)
提交回复
热议问题