none
在ASP.NET MVC4里面怎么判断是否为手机访问 RRS feed

答案

  • protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            WebApiConfig.Register(GlobalConfiguration.Configuration);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            AuthConfig.RegisterAuth();
    
            DisplayModeProvider.Instance.Modes.Insert(0,
                 new DefaultDisplayMode("Mobile")
                 {
                     ContextCondition = (ctx => (
                         (ctx.GetOverriddenUserAgent() != null) && ctx.Request.Browser.IsMobileDevice
                 ))
                 });  
        }     


    大家一齊探討、學習和研究,謝謝!
    MCSD, MCAD, MCSE+I, MCDBA, MCDST, MCSA, MCTS, MCITP, MCPD,
    MCT, Microsoft Community Star(TW & HK),
    Microsoft MVP for VB.NET since 2003
    My MSMVP Blog

    請記得將對您有幫助的回覆標示為解答以幫助其他尋找解答及參與社群討論的朋友們。
    Please remember to clickMark as Answer on the post that helps you. This can be beneficial to other community members reading the thread.

    2015年3月4日 1:32

全部回复