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

Area routing issue

$
0
0

I have an asp.net core 2.0 project with two areas defined, the directory hierarchy resembles a default layout for an app and api project which is simply moved under .\Areas\{Api|App}.
I am using attribute routing on the controllers within each area and they work fine. However I want a default for the app area such that if a user browses to the root "/" or the area "/app", the route completes to /app/home/index however nothing I try is Startup works.

For example, none of the following three work:

app.UseMvc(
    routes =>
    {
        routes.MapRoute("areaRoute", "{area:exists}/{controller=home}/{action=index}/{id?}");
        routes.MapAreaRoute("index","app","{area:exists}/{controller=home}/{action=index}/{id?}");
        routes.MapRoute("default", "app/{controller=home}/{action=index}/{id?}");
    });

Anyone have an idea what i am missing?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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