2013-01-24 38 views
0

我想在Web窗體應用程序中實現MVC View Engine行爲。要註冊在MVC移動信道中我通常會做這樣的事情查看非MVC Web應用程序的引擎

public static List<string> UaSurfpads = new List<string>() 
{ 
    "iPad", 
    "MicrosoftRt", 
    "PlayBook" 
};  

protected void Application_Start(object sender, EventArgs e) 
{ 
    // register surfpads 
    foreach (string device in UaSurfpads) 
    { 
     DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("mobile") 
     { 
      ContextCondition = (context => context != null && context.GetOverriddenUserAgent().IndexOf(device, StringComparison.OrdinalIgnoreCase) >= 0) 
     }); 
    } 

    // ... 

} 

這將使我創造陰影的觀點一樣myView.mobile.cshtml

是否有任何類似的方式使用asp.net中的常規web表單工作?

回答

0

沒有什麼本地直播MVC來處理這個問題。但是,您可以通過在應用中添加一些代碼來檢測和重定向來實現此目的。 51 degrees使用這種方法,並創建了一個免費的框架來完成所有這些。我建議看看它,或者至少他們如何實現他們的移動實施,並模仿它爲您的網站。