Saturday, April 20, 2019

Trouble with routing Razor Pages

I'm fairly new to the ASP.NET Core framework. I have a razor page called Page. When I have a user who goes to the route:

https://mysite.com/Page/asdf, it does resolve to the Page.cshtml/Page.cshtml.cs. And My OnGetAsync(string slug) method is picking up that asdf portion. The trouble I'm hitting though is that I want the routes: - https://mysite.com/Page - https://mysite.com/Page/

to also resolve to the OnGetAsync() method. Right now I'm being treated with a blank page, and the terminal window says it's serving a 404. I've tried looking through the docs, and googling to find an answer, but I've had no luck. Is there some setting in Startup.cs I'm forgetting to do?

Trouble with routing Razor Pages Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team