格式ASP.Net MVC应用程序的桌面和移动浏览器 [英] Format ASP.Net MVC app for desktop and mobile browser

查看:80
本文介绍了格式ASP.Net MVC应用程序的桌面和移动浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一个ASP.Net MVC应用程序与我希望能够为桌面浏览器和移动浏览器进行格式化的意见。这两种格式都将使用相同​​的控制器和动作,但需要不同的看法。

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 Controllers and Actions but require different views.

什么是做到这一点的最好方法是什么?办一个浏览器在操作检测,然后调用相应的看法?是否认为做浏览器检测,然后使自己相应的?有之间的一些回报查看(); 并在观点实际上被处理,我可以重写?

What's the best way to do this? Do I do a browser detect in the Action and then invoke the appropriate view? Does the view do the browser detect and then render itself accordingly? Is there something in between return View(); and when the view actually is processed that I can override?

感谢

推荐答案

ScottHa有<一个href=\"http://www.hanselman.com/blog/MixMobileWebSitesWithASPNETMVCAndTheMobileBrowserDefinitionFile.aspx\"相对=nofollow>这篇文章关于解决了同样的问题,针对与ASP.NET MVC多个设备。

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...)

这篇关于格式ASP.Net MVC应用程序的桌面和移动浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆