Home » Microsoft » 70-486 v.2 » Which two approaches can you use?
You develop an ASP.NET MVC application. The application has several Razor views. The application must execute different server-side code for desktop and mobile devices.
You need to choose an approach to support mobile devices.
Which two approaches can you use? Each correct answer presents a complete solution.
A. Use different controllers and view for both desktop and mobile browsers, but render the views using Bootstrap framework.
B. Create separate areas for desktop and mobile browsers, implementing independent controllers and views for each.
C. Use the same controllers for both desktop and mobile browsers, but render different views depending on the device type.
D. Use different controllers and views for both desktop and mobile browsers, but render the views with the same Razor layout depending on the device type.
Correct Answer: BD
Explanation/Reference:
How ASP.NET MVC applications can present mobile-specific pages
Since the Model-View-Controller pattern decouples application logic (in controllers) from presentation logic (in views), you can choose from any of the following approaches to handling mobile support in server-side code:
1.Create separate areas for desktop and mobile browsers, implementing independent controllers and views for each. This option works best if you’re displaying very different screens, containing different information and leading the user through different workflows optimized for their device type. It may mean some repetition of code, but you can minimize that by factoring out common logic into an underlying layer or service.
2.Use the same controllers for both desktop and mobile browsers, but render different views depending on the device type. This option works best if you’re displaying roughly the same data and providing the same workflows for end users, but want to render very different HTML markup to suit the device being used.
3.Use the same controllers and views for both desktop and mobile browsers, but render the views with different Razor layouts depending on the device type. This option works best if you’re displaying identical data on all devices, but simply want to supply different CSS stylesheets or change a few top-level HTML elements for mobiles.
References: https://docs.microsoft.com/en-us/aspnet/whitepapers/add-mobile-pages-to-your-aspnet-web-forms-mvc-application
The answer is BD because “the application must execute different server-side code for desktop and mobile devices”.
B. Create separate areas for desktop and mobile browsers, implementing independent controllers and views for each.
C. Use the same controllers for both desktop and mobile browsers, but render different views depending on the device type.
Correct answer : B, C