Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

ASP.Net Core 2 and Routing with Areas. I get a blank page when routing

$
0
0

Hi All,

I am using ASP.Net Core 2 MVC Template using Individual authentication to build a web app. I am using Areas in my project, however when I navigate to a view or page in an area called System I get a blank page. https://localhost:44325/System/Central/Index

Here is my routing code from the startup.cs as follows:

app.UseMvcWithDefaultRoute();

app.UseMvc(routes =>
{
//routes.MapRoute(
// name: "default",
// template: "{controller=Home}/{action=Index}/{id?}");

// routes.MapRoute(
// name: "areas",
// template: "{area:exists}/{controller=Home}/{action=Index}/{id?}"
//);

routes.MapRoute(
name: "areaRoute",
template: "{area:exists}/{controller=Home}/{action=Index}/{id?}");

routes.MapRoute(
name: "areaAdminRoute",
template: "{area=Admin}/{controller=ControlPanel}/{action=Index}/{id?}");


routes.MapRoute(
name: "areaSystemRoute",
template: "{area=System}/{controller=Central}/{action=Index}/{id?}");

routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
});

The routing does not work in the Area section of the web project; only the "default" route.


Regards


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>