javascript - C# MVC 5, RouteJs returns HTML instead of JS -
i installed routejs mvc 5 via nuget , followed installation instructions, contents of _layout.cshtml , status of 200 returned when attempting load <script src='/routejs.axd/251810a87f19ffe842a619acc9a90d73349ba4fa/router.js'></script>
.
i'm running mvc 5, c#, , iis express 8. i've tried new variations of web.config found on github / nuget website. additional configuration required if i'm using areas?
#_layout.cshtml #this works <script src="@routejs.routejshandler.handlerurl"></script> #web.config <configsections> <section name="routejs" type="routejs.routejsconfigurationsection, routejs" /> </configsections> #this section break application. #added 'validation' line system.webserver prevent error #i've tried running routejs , without section. <system.web> <httphandlers> <add verb="get" path="routejs.axd" type="routejs.routejshandler, routejs" /> </httphandlers> </system.web> <system.webserver> <handlers> <validation validateintegratedmodeconfiguration="false"/> <add name="routejs" verb="get" path="routejs.axd" type="routejs.routejshandler, routejs" /> </handlers> </system.webserver> <routejs exposeallroutes="true" /> #registerroutes routes.ignoreroute("{resource}.axd/{*pathinfo}");
you have declare kind of code area in order add route:
public class adminarearegistration : arearegistration { public override string areaname { { return "admin"; } } public override void registerarea(arearegistrationcontext context) { context.maproute( "admin_default", "admin/{controller}/{action}/{id}", new { action = "index", id = urlparameter.optional } ); } }
Comments
Post a Comment