Can't register routes searched for 10hours still can't find what I 'm doing wrong.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
6 年 前
Hi it's been a while since I've developed a Nopcommerce plugin and I can't find any way to register a route and reach it. I spend over 10hours looking online trying all sorts of examples just to register a simpel route to a simple controller.  Can some one please point me out what the @#|?/*! I'm doing wrong?

I would like to reach an custom admin controller with this path

localhost:port/Admin/TableConfigurator/DeckSettingsList

The controllers name is TCAdminController. The action is DeckSettingsList


A link to the whole project can be found here: https://ufile.io/jhykf

Hopefully someone can help me out.

This is my route provider:

namespace Nop.Plugin.Misc.TableConfigurator.Infrastructure
{
    public class RouteProvider : IRouteProvider
    {
        public int Priority
        {
            get { return 1; }
        }

        public void RegisterRoutes(RouteCollection routes)
        {
                routes.MapRoute(
               "Nop.Plugin.Misc.TableConfigurator",
               "Admin/TableConfigurator/{action}",
               new { controller = "TCAdminController", action = "DeckSettingsList" },
               new[] { "Nop.Plugin.Misc.TableConfigurator.Controllers" }
            ).DataTokens.Add("Area", "Admin");

            ViewEngines.Engines.Insert(0, new ViewEngine());
        }
    }
}
6 年 前
Hi

maybe remove the area part, admin isn't an area. or set it to null - that is what i do.
6 年 前
Thanks for the reply but it doesn't seem to work. Is there away to display all registered routes when nopcommerce is running? Maybe I'm just pointing to the wrong url. If I could have list of each registered route it could be solved.


Is it with this routeprovider ok to say it should point to: localhost/Admin/TableConfigurator/DeckSettingsList. Do you know any other facts that could influence a route?
6 年 前
Just as a test, try it without the "Admin/"   - i.e. "TableConfigurator/{action}",
6 年 前
New York wrote:
Just as a test, try it without the "Admin/"   - i.e. "TableConfigurator/{action}",


Thanks but that doesn't work either.

Is there a way to display all available urls when nopcommerce runs? When I know what url to build my problem is solved. I've got the feeling i'm just manually point to the wrong url. I know 100% the route get's registered because it reaches a break point I've set. This is what get's set:

6 年 前
 routes.MapRoute(
               "Nop.Plugin.Misc.TableConfigurator",
               "Admin/TableConfigurator/{action}",
               new { controller = "TCAdminController", action = "DeckSettingsList" },
               new[] { "Nop.Plugin.Misc.TableConfigurator.Controllers" }
            ).DataTokens.Add("Area", "Admin");


Referring to the above code, you should not have the word "Controller" in your route configuration.

So it should be

new { controller = "TCAdmin", action = "DeckSettingsList" },


This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.