Link Details

Link 888397 thumbnail
User 225256 avatar

By mswatcher
Submitted: Dec 07 2012 / 12:32

You can build custom views for mobile devices in ASP.NET MVC 4 using the DisplayModeProvider features of the framework (see "Browser Specific Views" of the "ASP.NET MVC 4 Mobile Features" article for more details). The default view switching behavior happens by ultimately looking at the incoming user agent header to determine if the request came from a a mobile device, but display modes can do more than just peek at user agent strings. Let's say we don't want a user agent or cookie to tell us which view to use. Instead, we want information in the path of the URL to tell us the view to use. For example, the following URL should always use a "normal" view like Layout.cshtml:
  • 1
  • 0
  • 207
  • 146

Add your comment

Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (1)

Voters Against This Link (0)

    Apache Hadoop
    Written by: Piotr Krewski
    Featured Refcardz: Top Refcardz:
    1. Play
    2. Akka
    3. Design Patterns
    4. OO JS
    5. Cont. Delivery
    1. Play
    2. Java Performance
    3. Akka
    4. REST
    5. Java