Note that there are some explanatory texts on larger screens.

plurals
  1. POTrouble with routing in ASP.NET MVC
    primarykey
    data
    text
    <p>I've got an ASP.NET MVC site under a Classic ASP site. The MVC site is:</p> <p><a href="http://www.inrix.com/traffic" rel="nofollow">http://www.inrix.com/traffic</a></p> <p>The routes</p> <p><a href="http://www.inrix.com/traffic" rel="nofollow">http://www.inrix.com/traffic</a><br/> <a href="http://www.inrix.com/traffic/home" rel="nofollow">http://www.inrix.com/traffic/home</a><br/> <a href="http://www.inrix.com/traffic/features" rel="nofollow">http://www.inrix.com/traffic/features</a><br/></p> <p>work fine. However, the route:</p> <p><a href="http://www.inrix.com/traffic/support" rel="nofollow">http://www.inrix.com/traffic/support</a></p> <p>does not. Click it to see what I'm getting. If I include the action:</p> <p><a href="http://www.inrix.com/traffic/support/index" rel="nofollow">http://www.inrix.com/traffic/support/index</a></p> <p>it works.</p> <p>When I run this at home by pressing F5 in VS, it works fine with just <a href="http://www.inrix.com/traffic/support" rel="nofollow">http://www.inrix.com/traffic/support</a> (i.e., no action specified). Here are my routes:</p> <pre><code>public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Terms", "{controller}/{id}", new { controller = "Terms", action = "Index" } ); routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional } ); routes.MapRoute( "ThankYou", "{controller}/{action}/{email}/{id}" ); } </code></pre> <p>www.inrix.com/traffic maps to HomeController (Index action).</p> <p>I want www.inrix.com/traffic/support to map to SupportController, Index action.</p> <p>What's going on with the "support" route?</p> <p><strong>Additional Code:</strong></p> <p>Controller:</p> <pre><code>using System.Web.Mvc; namespace InrixTraffic.Controllers { public class SupportController : Controller { public ActionResult Index() { return View(); } } } </code></pre> <p>View:</p> <pre><code>@{ Layout = null; } &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta name="viewport" content="width=device-width" /&gt; &lt;title&gt;Support&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Hello!&lt;/h1&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>New route:</p> <pre><code> routes.MapRoute( "Support", "traffic/support", new { controller = "Support", action = "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.
 

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