I am creating system which should display base _Host.cshtml for non-employee users. Base _Host.cshtml has completely different layout, design, css, script files.
How to create another like _Host.cshtml file? Every request starting with "/admin" should redirect to this new _Host.cshtml. Also every page will have attribute requesting user policy.
How would you solve this? Thanks
@glararan thanks for contacting us.
@javiercn Thanks for reply! You should definitely add this into documentation as an example :)
@javiercn May I ask how should folder structure look like? Kinda figuring out how to get it working. In src directory should be folder "Admin"?
Currently my file structure looks like
Pages/...razor files
Pages/Account/..razor files
Pages/Admin/Admin.cshtml (page "/Admin")
Pages/Admin/AdminLayout.razor
Pages/Admin/Home/Index.razor (page "/Admin/Dashboard")
Pages/Admin/.../...razor files
Now I get error 500. Not found
Pages/Admin/Home/Index.razor page "/" result into mismatch. page "/admin" results into using _Host.cshtml instead Admin.cshtml
EDIT: Figured it out.
Moved Pages/Admin/Admin.cshtml to Pages/_Admin.cshtml
Used
MapFallbackToPage("~/Admin/{*clientroutes:nonfile}", "/_Admin")
Pages/Admin/Home/Index.razor
@page "/admin"
Pages/Admin/_Host.cshtml for your entry point (set the right href in the base tag) and then you can put .razor pages inside Admin. Like Index.razor and so on.