My end goal is to have a <Script>
line in the _layout that will be generated from Database data. Step 1 for me is to simply display a comment line in the "head" portion of the page. I have a test program that does this just fine. When I copy the code over to my site I get "No route in the route table matches the supplied values." when I run the web. The error is pointing to the @Html.Action("OVars","MyO") statement in _layout.
I have tried to use Glimpse and RouteDebugger but I am not able to get any data on what this route actually is being generated as and then why it is failing. The output from RouteDebugger has a list of about 30 to 40 routes of which only the "Default" route is in Global.asax.cs. So I can only assume that these routes are being created elsewhere in the code.
@Html.Action("OVars","MyO")
The controller contains:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
namespace MySite.Controllers
{
public class MyOController : Controller
{
// ChildActionOnly will not allow direct displaying of this page
[ChildActionOnly]
public ActionResult OVars()
{
return PartialView("_OVars");
}
}
}
The _OVars partialview:
<!-- Test comment simply for displaying -->
Global.asax.cs
public static void RegisterRoutes(RouteCollection routes)
{
ViewEngines.Engines.Clear();
ViewEngines.Engines.Add(new RazorViewEngine());
routes.IgnoreRoute("{resource}.ico");
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
}
Any suggestions on what to look at would be a help. For all I know there is a parameter set that I am not aware of that needs to be changed.
Thanks