MVC5 scope not working properly

This entry is directly related to: MVC5 scope not working

This article fixed the index.cshtml problem, however, it did not allow every view for this controller. For instance:

http://localhost:45970/Setup/Start gives an error that the resource cannot be found (basically, 404).

However, it http://localhost:45970/Setup/Setup/Startdisplays the correct page.

So, what needs to be reconfigured so that ALL views for this controller in the settings area are opened correctly?

Change 1

Code from SetupAreaRegistration.cs

using System.Web.Mvc;

namespace BlocqueStore_Web.Areas.Setup
{
    public class SetupAreaRegistration : AreaRegistration
    {
        public override string AreaName
        {
            get
            {
                return "Setup";
            }
        }

        public override void RegisterArea(AreaRegistrationContext context)
        {
            context.MapRoute(
                name: "Setup_default",
                url: "Setup/{controller}/{action}/{id}",
                defaults: new { action = "Index", controller = "Setup", id = UrlParameter.Optional },
                namespaces: new[] { "BlocqueStore_Web.Areas.Setup.Controllers" }
            );
        }
    }
}
+1
source share
1 answer

Setup , http://localhost:45970/Setup/Start StartController Setup Area. 404, StartController Setup Area, http://localhost:45970/Setup/Setup/Start , SetupController Start Setup.

URL

http://{host}/Setup/‌​{view}
http://{host}/Admin/‌​{view}

, . AdminController SetupController, .

+1

Source: https://habr.com/ru/post/1651475/


All Articles