So my question is is it possible to move the _Host file without confusing routing. Or is there a way to specify I want to use a folder called Areas instead of Pages?
We can move the _Host file to the Areas/subfolder. Then, when set up the root page of the app, we need to use the MapFallbackToAreaPage("{page}", "{Areas}")
method, instead of the MapFallbackToPage
method.
Refer to the following sample: I create a MyTest Areas and add a _MyHost.cshtml host page:
And the _Host.cshtml page as below: you can also delete this _Host.cshtml page.
Then in the program, use the MapFallbackToAreaPage("{page}", "{Areas}")
method to set up the root page of the app:
After that the navigation works well on my side.
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best regards,
Dillion