使用 ASP.NET-MVC 实现 WAP 站点
我们计划使用 ASP.NET-MVC 实现 WAP 站点。
有人有这方面的经验吗?有什么陷阱吗?
我们还将为浏览器实现一个“标准”网站。是否可以拥有一组模型和控制器,并且每个站点都有单独的视图?
We plan on implementing a WAP site using ASP.NET-MVC.
Has anyone any experiance of this? Are there any Gotchas?
We will also be implementing a "standard" web site for browsers. Would it be possible to have a single set of Models and Controllers, and just have seperate views for each site?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
大多数情况下可以有一组模型和控制器。
实现方法是通过实现以下主题/模板引擎。
[主题支持][1]
我在主题/模板引擎之上支持了我的解决方案。
与文章源代码的主要偏差在于 Global.asax.cs 文件,您需要在其中添加以下代码行:
我知道我必须进行一些代码更改才能使其与 MVC 1 兼容,但我不能记住确切的变化。
我遇到的另一个主要问题是调试输出。为此,我使用了带有扩展程序([用户代理切换器][2])的 Firefox,我已更改该扩展程序以向其中添加接受类型。
对于 WAP2/XHTML1.2,接受类型为:text/html,application/vnd.wap.xhtml+xml,application/xhtml+xml,application/xml;q=0.9,/;q= 0.8
显然,您需要母版页和内容页遵守 WML 或 XHTML1.2
[1]: http://frugalcoder.us/post/2008/11/13/ASPNet-MVC-Theming.aspx 主题支持
[2]:http://chrispederick.com/work/user-agent-switcher/ 用户代理切换器
It is possible to have for the most part a single set of models and controllers.
The way to do it will be via implementing the following Theming/Templating engine.
[Theming Support][1]
I piggy backed my solution on top of a Theming/Templating engine.
The major deviation from the article source is in the Global.asax.cs file where you need to add the following lines of code:
I know I had to make a couple of code changes to make it MVC 1 compatible, but I can't remember the exact changes.
The other major problem I had was debugging the output. For this I used firefox with an extension ([User Agent Switcher][2]) that I've changed to add Accept Types to it.
For WAP2/XHTML1.2 the Accept Types are: text/html,application/vnd.wap.xhtml+xml,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
Obviously you need your masterpage and content pages to adhere to WML or XHTML1.2
[1]: http://frugalcoder.us/post/2008/11/13/ASPNet-MVC-Theming.aspx Theming Support
[2]: http://chrispederick.com/work/user-agent-switcher/ User Agent Switcher