Developing ASP.NET MVC Web Applications — Question 10
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.
Answer options
- 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: B, D
Explanation
Option B is correct because creating separate areas allows for tailored controllers and views for each device type. Option D is also correct as it allows for different controllers and views while maintaining a consistent Razor layout. Options A and C are incorrect because they do not provide complete solutions that independently support the distinct requirements for mobile and desktop devices.