I want to create area like the following structure
- Areas
- Admin
- FrontEnd
- Controllers
- HomeController.cs
- Views
- Controllers
- API
- Controllers
- HomeController.cs
- Controllers
- FrontEnd
- Admin
Startup class
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug();
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
app.UseBrowserLink();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseStaticFiles();
app.UseMvc(routes =>
{
routes.MapRoute(name: "areaRoute",
template: "{area:exists}/{controller=Home}/{action=Index}");
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});
}
I already marked [Area("Admin/FrontEnd")] to HomeController but it doesn't work. It return the following error
An unhandled exception occurred while processing the request.
InvalidOperationException: The view 'About' was not found. The following locations were searched: /Areas/Admin/Views/Home/About.cshtml
How can I do?
Project