mvc使用DisplayMode支持一个action对应不同的view
钢翼
编程
参考:http://www.cnblogs.com/egger/p/3400076.html
步骤:
1.在Application_Start中添加以下代码
DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("Mobile")
{
ContextCondition = context =>
context.GetOverriddenBrowser().IsMobileDevice
});2.添加同名视图,后缀以“.Mobile.cshtml”结尾。