Home > OS >  Problem! Working with application part from different projects with area logic. view not found
Problem! Working with application part from different projects with area logic. view not found

Time:12-24

In Asp.net Core 5, my area is the same solution in a different project. I import the dlls with the application part, but. When I go to the index page in the area, it cannot find the view. It falls into the action in the controls, but cannot find the view. What can I do for solution?

enter image description here

app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");

                endpoints.MapAreaControllerRoute(
                    name: "default_area",
                    areaName:"Test",
                    pattern: "{area:exists}/{controller=Home}/{action=Index}/{id?}");
            });



[Area("Test")]
    public class HomeController : Controller
    {
        public IActionResult Index()
        {
            return View();
        }

        public IActionResult Privacy()
        {
            return View();
        }

        public IActionResult Testtt()
        {
            return View();
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }
    }

CodePudding user response:

I also got this error before. When I swapped the MapAreaControllerRoute definition to the top, I was able to access my area.

CodePudding user response:

only when I start the project, first I open the main place and then I direct it with javascript according to the area type. I did what you said, but the view not found error came.

  • Related