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

  • Question

  • 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


    se

    • Moved by Fei Hu Wednesday, January 31, 2018 9:31 AM ASP.NET related
    Monday, January 29, 2018 4:01 PM

All replies

  • http://forums.asp.net/

    It's where you should post.

    Monday, January 29, 2018 4:08 PM
  • ok thanks

    se

    Monday, January 29, 2018 4:13 PM
  • Hi andy2008,

    According to your question is more related to ASP.Net, You could repost a new thread to ASP.Net forum for suitable support.

    If you have some grammar or code errors in using C#, please feel free to contact us. We will try our best to give you a solution.

    Best Regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, January 31, 2018 9:30 AM