Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm having a little trouble picturing your setup. My guess is you have the current setup:</p> <p><strong>Controllers</strong><br /> &nbsp;&nbsp;&nbsp;&nbsp;- HomeController.cs <br /> &nbsp;&nbsp;&nbsp;&nbsp;- MobileController.cs<br /> <strong>Views</strong><br /> &nbsp;&nbsp;&nbsp;&nbsp;- Home<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Index.aspx<br /> &nbsp;&nbsp;&nbsp;&nbsp;- Mobile<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Index.aspx<br /></p> <p>But you want: <br /> <strong>Controllers</strong><br /> &nbsp;&nbsp;&nbsp;&nbsp; - HomeController.cs<br /> <strong>Views</strong><br /> &nbsp;&nbsp;&nbsp;&nbsp;- Home<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Index.aspx<br /> &nbsp;&nbsp;&nbsp;&nbsp;- Mobile<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Index.aspx<br /></p> <p>Is that correct?</p> <h2>Update:</h2> <p>Aas people mentioned below it's one of those 'that's just how MVC works' sort of deal. 'Home' is a location you can go to, but 'Mobile' is a specific type of page. If you add another area called "About" as new Views subfolder, where would you put your mobile folder? What is mobile now supposed to handle? If mobile is not supposed to replicate the regular site, then it should have its own controller, even if it replicates some code (don't forget you can create classes outside the controllers that can do the brunt of the work that any controller can call). <br /><br /> On the other hand if you want a mobile version of each of your pages you should be adding them under the views folder for each route. For example:</p> <p><strong>Controllers</strong><br /> &nbsp;&nbsp;&nbsp;&nbsp; - HomeController.cs<br /> <strong>Views</strong><br /> &nbsp;&nbsp;&nbsp;&nbsp;- Home<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Mobile<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -- Index.aspx<br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --Index.aspx<br /></p> <p>I'm not exactly sure where you are doing the logic to figure out if they are on a mobile platform, but assuming for now it's in the controller somewhere in your HomeController.cs you then have:</p> <pre><code>public ActionResult Index() { if([check for mobile]) { return View("Mobile/Index"); } else { return View("Index"); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload