Quantcast
Channel: Active questions tagged blazor - Stack Overflow
Viewing all articles
Browse latest Browse all 4839

How to I add a Razor page to a Blazor project?

$
0
0

I've been trying to add in some Razor pages *.cshtml into a blazor project. But when I try to access the page I get a 404 not found.

To reproduce what I'm facing, I create a blank new blazor Web app project from template,now I right click pages, and add a empty Razor page:

enter image description here

I add the directive @page "/testing"but when I try to navigate to this page, it's giving a 404 error.

I've added the builder.Services.AddRazorPages() to the startup code but that didn't help.

Anything else that I'm missing? Is there any steps to troubleshoot the routing system in asp.net core? I'm assuming it's stuck in the Blazor mode, where it is registering blazor components only into the routes, the blazor pages are not being processed.


Viewing all articles
Browse latest Browse all 4839

Trending Articles



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