A
A
Andrey Dyrkov2016-01-29 17:59:55
ASP.NET
Andrey Dyrkov, 2016-01-29 17:59:55

How to configure routers in two applications?

Created several projects, one admin panel, the other just an application.
When I run the solution, only the admin route is processed

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace IQS
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Admin",
                url: "Admin/{controller}/{action}/{id}",
                defaults: new { controller = "Service", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}

and I can’t get another application at all, 404.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace Widget
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            routes.MapRoute(
                name: "Default",
                url: "Widget/{controller}/{action}/{id}",
                defaults: new { controller = "Service", action = "Index", id = UrlParameter.Optional }
            );
        }
    }
}

Project structure:
8f5115ca87774b8bac9fa011d6b7473b.png
I have no experience in mvc so I can't figure out how to solve problems, maybe area maybe namespace..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Mokhov, 2016-02-13
@Kolay_Net

Why have separate projects been created?
Use one project, and in it already create areas (Areas) for the admin panel and the application itself.
You can read about it here
metanit.com/sharp/mvc5/6.5.php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question