GithubHelp home page GithubHelp logo

routejs's Introduction

RouteJs

RouteJs allows you to use your ASP.NET MVC or WebForms routes from JavaScript. It does not depend on jQuery or any other JavaScript framework, so can be used in any scenario. RouteJs works with your existing MVC routes, you do not need to use a different routing syntax or modify any of your existing routes at all.

Bug reports and feature requests are welcome!

Build status  NuGet downloads  NuGet version 

Requirements

Required:

  • ASP.NET 4.0 or higher
  • Json.NET
  • Any version of ASP.NET MVC from 2 onwards, including ASP.NET Core

Installation

For ASP.NET MVC 5 and older

Install-Package RouteJs.Mvc4

(replace RouteJs.Mvc4 with RouteJs.Mvc3 for ASP.NET MVC 3 or RouteJs.Mvc2 for ASP.NET MVC 2)

Alternatively, you can get the latest development build from the build server.

Once installed, you need to reference the RouteJs handler in your view. This serves the JavaScript and route information:

<script src="@RouteJs.RouteJsHandler.HandlerUrl"></script>

For ASP.NET Core and ASP.NET Core MVC

Install-Package RouteJs.AspNet

Once installed, you need to add RouteJs to your Startup.cs file, and also ensure IActionContextAccessor is registered:

using Microsoft.AspNetCore.Mvc.Infrastructure;
using RouteJs;
...
services.AddSingleton<IActionContextAccessor, ActionContextAccessor>();
services.AddRouteJs();

The RouteJs handler also needs to be referenced in your view (generally _Layout.cshtml is a good place for this). This serves the JavaScript and route information:

@inject RouteJs.IRouteJsHelper RouteJs
@RouteJs.Render()

Usage

The main function is Router.action. This accepts three parameters:

  • Name of the controller
  • Name of the action
  • Any additional parameters

Examples:

// Using the default route
var url = Router.action('Controller', 'Action'); // eg. /Controller/Action

// Handling optional parameters
var url = Router.action('Foo', 'Bar', { id: 123 }); // eg. /Foo/Bar/123

// Appending querystring parameters
var url = Router.action('Foo', 'Bar', { hello: 'world' }); // eg. /Foo/Bar?hello=world

The routes that are exposed are controlled by the web.config "exposeAllRoutes" setting for ASP.NET MVC 5 and below:

<routeJs exposeAllRoutes="true" />

And via Startup.cs for ASP.NET MVC 6:

services.AddRouteJs(config => {
	config.ExposeAllRoutes = true;
});

If set to "true", all of your ASP.NET MVC routes will be exposed to JavaScript, unless you explicitly hide them via the HideRoutesInJavaScript attribute on a controller. If set to "false", all routes will be hidden unless you explicitly use the ExposeRoutesInJavaScript attribute on the controller. These two attributes currently affect all routes for the controller.

Changelog

2.2 - 1st July 2017

  • #53 - Upgrade to ASP.NET Core 1.1 RTM
  • Update AddRouteJs method to make configure argument optional

2.1 - 28th May 2016

  • Updated to ASP.NET Core RC2
  • #49 - Use / as default base URL when empty
  • #51 - Ensure base path ends with /

2.0.3 - 20th November 2015

  • Updated ASP.NET 5 support to RC 1.

2.0.2 - 25th October 2015

  • Updated ASP.NET 5 support to beta 8.
  • #43 - Add LowerCaseUrls option to convert generated URLs to lowercase. Thanks to Mohammad Rahhal.
  • #37 - Handle empty URLs (ie. home page).

2.0.1 - 13th September 2015

  • Updated ASP.NET 5 support to beta 7
  • #41 - Correctly handle when routes in areas have "area" default param

2.0 - 23th August 2015

  • Added support for ASP.NET 5 and MVC 6

1.1.9 - 24th January 2015

  • #38 - Fix handling of constraints with case-insensitive URL parameters.

1.1.8 - 26th October 2014

  • #34 - Ignore case of controller, action, area, and keys of parameters.

1.1.7 - 6th July 2014

  • #32 - Only include string (regular expression) constraints, ignore custom constraints as they can't be evaluated client-side.

1.1.6 - 27th April 2014

  • #31 - Defaults and optional parameters are sometimes serialised as null

1.1.5 - 17th November 2013

  • #27 - NullReferenceException for routes without DataTokens.
  • Added package for ASP.NET MVC 5

1.1.4 - 10th September 2013

  • #22 and #24 - Handle error when loading types from referenced assemblies.

1.1.3 - 7th August 2013

  • #21 - NullReferenceException thrown on ignored routes.

1.1.2 - 6th August 2013

  • #18 - Only expose a route's default area if at least one controller in that route is exposed
  • Small JavaScript cleanup (split huge route method into several smaller methods)

1.1.1 - 26th July 2013

  • #14 - Cache JavaScript for one year
  • #17 - Ensure area route isn't used if area is not specified in Router.action call

1.1.0 - 10th June 2013

  • Added support for ASP.NET MVC 2 and 3
  • Bug fixes around T4MVC routes
  • Changed cachebusting hash from querystring parameter to URL path parameter

1.0.1 - 4th June 2013

  • Fixed issue with routes in areas not working correctly

1.0 - 23rd May 2013

  • Initial release

Licence

(The MIT licence)

Copyright (C) 2013 Daniel Lo Nigro (Daniel15)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

routejs's People

Contributors

daniel15 avatar hermanho avatar jfensch avatar jni- avatar mrahhal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

routejs's Issues

router.js not found

I installed RouteJS MVC 4 package from nuget, after installation was done, I added
<script src="@RouteJs.RouteJsHandler.HandlerUrl"></script>
to head section of _Layout.cshtml and run application.
After starting of application I got
Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:50326/routejs.axd/49ba8976e3844742e2a86747a52c0d4d81ceab37/router.js

Controller defined before action?

I was curious why the decision was made to define the controller as the first argument as opposed to the action, which is the pattern MVC implements.

Controller whitelist/blacklist only checks name, not namespace

The controller white/blacklists currently only check the controller based on its name. This means that if there's multiple controllers with the same name in different areas, they won't be filtered correctly. Namespace needs to be checked in addition to class name.

Also see #18

AddRouteJs

I think it's worth mentioning that:

services.AddRouteJs().ConfigureRouteJs(config => {
	config.ExposeAllRoutes = true;
});

Should be:

services.AddRouteJs(config =>
{
   config.ExposeAllRoutes = true;
});

Action() parameter order

Just installed RouteJS and am looking forward to using it.

The first thing I notice, however, is that the parameters for your Router.action() method are backwards compared to the MVC Razor @Url.Action() method -- in the MVC method, the action is the first parameter and the controller is second. For people like me who are used to using @Url.Action(), it's going to be difficult and error-prone to try to remember to swap the order of parameters when using RouteJS.

Support for MVC Attribute Routing

Love the feature, but I see we're unable to take advantage of attribute routing in it's current state. Are there any plans to support this in the future?

Suggestions

Hello Daniel,

Thanks for the great library! I just have 2 suggestions to make this library even better.

I think you can increase javascript file cache to 1 year. If generated file changes, it will also change hash value in url and browser will make a new request for this file. So you can set the cache to 1 year instead of 1 day.

It would be really nice, if you add routing as method chain to your library, so we can use it this way:

Router.account.login({ username : "demouser" })

instead of

Router.action("Account", "Login", { username : "demouser" });

The reason why this feature is so important is because if I change controller or action name, it can happen that I forget to change some magic strings above and this will cause errors. But with this solution visual studio will notice errors and notify you. And then you can also use autocomplete :)

If you want to make your javascript files as small as possible, you can also add a property to disable this feature:

<routeJs exposeAllRoutes="true" routeAsMethodChain="false" />

Mismatch between how attribute routes inside areas are matched

This is tested in AspNet5 only.

There's a mismatch between how mvc matches some of the routes inside an area that are specified with RouteAttribute and how the javascript route helper is matching them.

The repo that reproduces the issue is here. Basically this is what is happening:
capture

For some reason, mvc generates the following route for CategoriesController.Some:

{
        "precedence": 1.11,
        "order": 0,
        "url": "manage/Categories/some.call",
        "defaults": {
            "controller": "Categories",
            "action": "Some"
        },
        "constraints": {},
        "optional": []
    }

That's why routejs thinks it's an attribute route outside any area. I guess we expected mvc to include thearea default also even if the route is attributed.

I'm not sure how we're supposed to solve this if mvc6 is not generating area default in this case. As it appears the logic of matching is not the same between mvc5/mvc6.

Case sensitive constraint keys break with v1.1.8

Creating an issue from my comment, by request.

I found out the change in 1.1.8 (Ignore case of controller, action, area, and keys of parameters) breaks some functionality on our site after a colleague updated from 1.1.7 to 1.1.8. For example:

C#

routes.MapRoute("Arbitrary Route", "path/{variableThing}/etc/", new { controller = "X", action = "Y" }, new { variableThing = "Z" });

JS

Router.Action('X', 'Y', { variableThing: 'Z' });

Now when the constraints are parsed, the key variable will be "variableThing". The objects however:

parsedConstraints['variableThing'] = /^(Z)/

routevalues['variablething'] = 'Z'

Due to the lower case key the route will not match.

Build instructions are unclear

I'm trying to build from source, but it seems to be more complicated than simply running build.bat.

  • I'm running VS 2012, so I need to run a previous version of build.bat.
  • I don't have a separate Git installation (using SourceTree with embedded Git), so I had to disable the <GitVersion part.
  • There's no package restore done for src\.nuget\packages.config so NUnit.Runners is missing, making the build fail near the end.

Area routes exposed even when exposeAllRoutes = "false"

I would expect that when is set in web.config that no routes are exposed until I decorate classes with the ExposeRoutesInJavaScript attribute. However, all my area routes appear to be exposed as Router.routes has 9 routes client-side. Is there something I'm missing?

Exception when handling custom constraints

Received via email:

Some of our routes use custom constraints. When these are parsed in the _parseConstraints methods in router.js, an exception occurs. The methods performs a replace action on this.route.constraints[key], but in the case I am looking at, this.route.constraints[key] is an (empty) object.

"Object reference not set to an instance of an object" error in web environment

Hello! First, thank you for your great project, it helps me keeping tidy the MVC routes in Javascript.

Today I published my current project (the one I first used RouteJs) in my web environment and I'm getting a "Object reference not set to an instance of an object." from the line <script src="@RouteJs.RouteJsHandler.HandlerUrl"></script> in _Layout.cshtml. I'm sure it's from here because without the line the pages load without problems.

I've double-checked the configuration settings in web.config from the readme file. I've also tested the debug attribute from with true and false values. Other important information is that in my local debugging environment, everything works fine.

I'm using the last version of RouteJS, MVC 5 in a IIS 8.0. I searched a lot for someone with the same problem, but I could not find. If you have any tip on this, I'd thank you a lot. I'm attaching a printscreen of the error.

Thanks in advance,
Rodrigo

image

settings.baseUrl in AspNet5 is an empty string

In AspNet5, the base path is "" where it should have been "/". This is not the same with mvc5 because the base url value is always "/" at runtime.
We should check for an empty string and use "/" instead when that happens to compensate for AspNet5.

Adds settings and attributes for route exposure.

Can we add a web.config setting?

<appSettings>
  <add key="RouteJS/ExposeAllRoutes" value="true"/>
</appSettings>

This patch would also add 2 attributes. [ExposeRouteInJavaScript] and [HideRouteInJavaScript]. If the ExposeAllRoutes setting is true, then the Hide attribute will hide the indicated routes. If the ExposeAllRoutes setting is false, then only routes marked with Expose will be exposed.

As for which should be the default behavior, I leave that to the project's author.

Null Reference Exception

I get a Null Reference Exception, possibly due to the BrowserLink feature in the new Visual Studio (it seems route.DataTokens is null in a route generated by BrowserLink).

I downloaded the code and added a quick fix. I should probably do a pull request, but I am not entirely sure this is the proper way to solve it:

// If there's no controller specified, we need to check if it's in an area
if (!route.Defaults.ContainsKey("controller"))
{
    // Added this line here:
    if (route.DataTokens == null)
        return false;

    // Not an area, so it's a "regular" default route
    if (!route.DataTokens.ContainsKey("area"))
        return true;

    // Exposing all routes, or an area that's explicitly whitelisted
    if (_configuration.ExposeAllRoutes || _areaWhitelist.Contains(route.DataTokens["area"]))
        return true;

    // In an area that's not exposed, so this route shouldn't be exposed.
    return false;
}

Problem with routes

I have published my mvc6 site on IIS. Path to my site looks like http://mydomain/mysite.com. So, in my Startup.cs I made a trick:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) {
    app.Map("/mysite", appBulder => RealConfigure(appBulder, env, loggerFactory));
}
public void RealConfigure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) {
    ....
}

All my urls are correct when I use @Url.Action("SomeAction", "SomeController") helper, but Router.action("SomeController", "SomeAction") gives me wrong url

ASP.NET 5 (vNext) support

  • Regular routes
  • Attribute routes
  • Get JavaScript loading correctly
  • Basic constraints
  • More advanced constraints / combining constraints
  • Hide / expose routes config
  • Rename IConfiguration as it conflicts with the ASP.NET type

Route .action - invalid route created (regression in v2.0)

This is an issue that only started after I upgraded to v2.0 of RouteJS

Called this route to validate - works fine, the route: {route} is from my js file SiteRoutes.js (see below for code snippet):

SiteRoutes.js:42 route:  /Auth/Login

Login validated, go to the main page, again works fine (see Inventory.IndexView() just below):

SiteRoutes.js:143 route:  /Inventory/Index

I believe this is output from RouteJS when it navigated to the above route:

Navigated to http://localhost:49850/Inventory/Index

Now I call AdminUser.IndexView() function below (note: same function everywhere, no variation)
and you can see that Router.action('AdminUser', 'Index') is appending the last route at the end

SiteRoutes.js:81 route:  /AdminUser/Index/%2FInventory%2FIndex

And the attempt to navigate to that route is going to fail since I want /AdminUser/Index only

Navigated to http://localhost:49850/AdminUser/Index/%2FInventory%2FIndex

Here is the basic routing js object I have setup to manage all my routes in one place:
You can see that every function just returns the Router.action(...) result

Inventory:
{
    IndexView: function ()
    {
        var route = Router.action('Inventory', 'Index');
        console.log('route: ', route);
        return route;
    },
},

AdminUser:
{
    IndexView: function ()
    {
        var route = Router.action('AdminUser', 'Index');
        console.log('route: ', route);
        return route;
    },

    // [Route("Create")]
    CreateView: function () 
    {
        var route = Router.action('AdminUser', 'Create');
        console.log('route: ', route);
        return route;
    },

    // [Route("Edit")]
    EditView: function () 
    {
        var route = Router.action('AdminUser', 'Edit');
        console.log('route: ', route);
        return route;
    },
},

Suggestion - ignore case when providing controller and action names

My preference has always been to use a custom route provider that auto-lowercases my routes. I see that the routes are case-sensitive, but seeing as how the casing is not a factor in the @Url.Action and other helper methods, it might help if the casing could be ignored.

Thoughts?

Area Routes Overrides Default Route

Hi Daniel,
We have faced the following issue:
In MvcApplication.RegisterRoutes we have this route definition:

routes.MapRoute(
    "Default",
    "{controller}/{action}/{id}",
    new { controller = "Account", action = "Login", id = UrlParameter.Optional }
);

And we have an Area with the name (Reports) and this route definition:

context.MapRoute(
    "Reports_default",
    "Reports/{controller}/{action}/{id}",
    new { action = "Index", id = UrlParameter.Optional }
);

On client if we use:

Router.action("Tag", "Create", { offeringId: 1})

Its outputting: "/site/Reports/Create/Tag?offeringId=1"
however, it should output: "/site/Tag/Create?offeringId=1"

We fixed this by adding this bit of code after including routeJs script:

Router.route = function(routeValues) {
    for (var i = 0, count = this.routes.length; i < count; i++) {
       // fix  Area Routes Overriding Default Route
       if (this.routes[i].route.defaults.area != routeValues.area)
        continue;
       // end
        var url = this.routes[i].build(routeValues);
        if (url) {
           return this.baseUrl + url;
        }
     }
     throw Error('No route could be matched to route values: ' + routeValues);
};

This will fix the issue
And we are thinking that in case we needed to get the action URL for the Area we will add area=areaName to route parameters like this:

Router.action("Reports", "List", { area : 'Reports'})

The question is are we following the correct approach here? is there any other way of doing this?

Synchronous XMLHttpRequest on the main thread is deprecated

Hi,
When I add the following line to my Index.Mobile.cshtml

script src="@RouteJs.RouteJsHandler.HandlerUrl"></script
(note: I removed the script tags so the script shows in the comment, else it gets suppressed)

I get the warning "Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check http://xhr.spec.whatwg.org/." in Google Chrome (Device emulation).

If I comment out the script, the warning goes away.
I am using jquery-2.1.1.min.js

Is this warning something I need to worry about? And is there a way to resolve this warning?

All the best,
Chris

Add note to 'Installation' documentation about validateIntegratedModeConfiguration

By default, a new MVC application will have this line in web.config:

<validation validateIntegratedModeConfiguration="false" />

When this is removed and RouteJs is installed, the application will throw an error, because web.config.transform contains these lines:

        <system.web>
                <httpHandlers>
                        <add verb="GET" path="routejs.axd" type="RouteJs.RouteJsHandler, RouteJs" />
                </httpHandlers>
        </system.web>

From MSDN: ValidationSection Class [IIS 7 and higher]

IIS generates a migration error message if the ValidateIntegratedModeConfiguration property is enabled and one of the following is true:

  • ...
  • Your application defines an section in its Web.config file.
    In IIS 7 Integrated mode, the ASP.NET handler mappings are specified in a unified section inside <system.webServer>. The section replaces both the ASP.NET and IIS script-processor-mapping configurations, which were both required to set up a ASP.NET 1.0 handler mapping.
  • ...

The solution is to remove this section. Can you add a note about this to the documentation? Or perhaps remove that part from the transform file, and add a note for IIS 6 users that they need to manually modify their web.config

NullReferenceException when used with Glimpse

Reported by Андрей Шелехин via email:

Hello Daniel! Thank you for your library RouteJs! I use it in my
projects now and write article in the best russian developers
community: http://habrahabr.ru/post/191248/

Today I found the error. I added to my project Glimpse:
http://getglimpse.com/ and after that I catch null reference exception
in @RouteJs.RouteJsHandler.HandlerUrl (HandlerUrl is null).

Sorry, if I write in english with errors.

T4 template to generate routes.js?

Do you think it would be possible to develop a t4 template that using RouteJS could generate a static route.js?

I would try to, but I don't know if it has dependecies on current executing context.

It would be very interesting for scenarios that requires bundling, AMD, etc..

Defaults and optional parameters are sometimes serialised as null

I don't like the sometimes part of this bug. I can randomly reproduce it by setting and removing debug="true" to force it to regenerate. So far I've seen it multiple times in the minified version and one time on the regular version, so I don't think it's related to minification.

Most of the times this is generated:

window.Router = new RouteJs.RouteManager({
    "routes": [{
        "url": "",
        "defaults": {
            "language": "nl",
            "controller": "Dashboard",
            "action": "Index"
        },
        "constraints": {},
        "optional": []
    }, {
        "url": "logging/exceptions/{resource}/{subResource}",
        "defaults": {
            "controller": "Logging",
            "action": "Exceptions"
        },
        "constraints": {},
        "optional": ["resource", "subResource"]
    }, {
        "url": "{language}/{controller}/{action}/{id}",
        "defaults": {},
        "constraints": {},
        "optional": ["id"]
    }, {
        "url": "{language}/{controller}",
        "defaults": {},
        "constraints": {},
        "optional": []
    }],
    "baseUrl": "/"
});

Sometimes this is generated:

window.Router = new RouteJs.RouteManager({
    "routes": [{
        "url": "",
        "defaults": null,
        "constraints": {},
        "optional": null
    }, {
        "url": "logging/exceptions/{resource}/{subResource}",
        "defaults": null,
        "constraints": {},
        "optional": null
    }, {
        "url": "{language}/{controller}/{action}/{id}",
        "defaults": null,
        "constraints": {},
        "optional": null
    }, {
        "url": "{language}/{controller}",
        "defaults": null,
        "constraints": {},
        "optional": null
    }],
    "baseUrl": "/"
});

Any idea what could cause this?

TypeScript typing

I've created a typing for RouteJs, could you review it to see if there are any errors? If there aren't, I'll submit it to DefinitelyTyped. Thanks!

declare module RouteJs
{
    interface Route
    {
        route: RouteInfo;

        build(routeValues: any): string;
    }

    interface RouteInfo
    {
        url: string;

        defaults: any;

        constraints: any;

        optional: Array<string>;
    }

    interface RouteManager
    {
        baseUrl: string;

        routes: Array<Route>;

        action(controller: string, action: string): string;
        action(controller: string, action: string, routeValues: any): string;

        route(routeValues: any): string;
    }

    interface RouteManagerSettings
    {
        baseUrl: string;

        routes: Array<RouteInfo>;
    }

    export var version: string;

    export function Route(route: RouteInfo): Route;

    export function RouteManager(settings: RouteManagerSettings): RouteManager;
}

declare var Router: RouteJs.RouteManager;

Add an option for enabling lower case urls

Self-explanatory, just like in mvc: RouteCollection.LowercaseUrls.

So that Router.action('Account', 'Login') generates /account/login with the option turned on, this way we can just write route values like we do in mvc without thinking much about it.

Also, for a route like Articles/{key}/Edit Router generates the route values uppercased no matter what I give it. And using something like Router.action(...).toLowerCase() is problematic for obvious reasons.

Thanks for the great library!

System.TypeLoadException

Hi,

I'm trying to wire this up in asp.net core : SDK version : 1.0.0-preview2-003131
I'm getting :

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeLoadException: Could not load type 'Microsoft.Extensions.DependencyInjection.ServiceCollectionExtensions' from assembly 'Microsoft.Extensions.DependencyInjection.Abstractions, Version=1.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
at RouteJs.ServiceExtensions.AddRouteJs(IServiceCollection services, Action`1 configure)
at Core.Startup.ConfigureServices(IServiceCollection services)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Microsoft.AspNetCore.Hosting.Internal.ConfigureServicesBuilder.Invoke(Object instance, IServiceCollection exportServices)
at Microsoft.AspNetCore.Hosting.Internal.WebHost.EnsureApplicationServices()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.BuildApplication()

Area route with "area" in defaults throws exception

My app routing works with no problems before adding RouteJs.
When I install RouteJs, the app crashes in the layout where I reference the script with src="@RouteJs.RouteJsHandler.HandlerUrl". The exception is "an item with the same key has already been added"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.