Giter VIP home page Giter VIP logo

Comments (2)

andrewlock avatar andrewlock commented on September 26, 2024 1

Hi @HelgeCPH!

The page you're trying to open /Simple does not exist, so you are getting a 404 result from the browser.

Inside the Razor Page you have the following directive:

@page "{category}"

which means "add the {category} segment to the page's default route template". As this is the Category.cshml page, the default route is Category, which gives a complete route of Category/{category}. In other words, if you browse to http://localhost:5043/Category/Simple your page should work 🙂

If you were building an app, and you didn't want the Category/ prefix, you could use the following in your Razor Page:

@page "/{category}"

Note the initial / which means "ignore any 'default' segments".

I hope that helps, let me know if you have any other issues!

Thanks for reading and trying it out! 😃

from asp-dot-net-core-in-action-3e.

HelgeCPH avatar HelgeCPH commented on September 26, 2024 1

Hej Andrew, thank you for the super quick answer! Your solution above is correct and works. That is, I forgot to add Category to the URL before the segment that will get passed as parameter to the handler... Thank you very much for the hint and also the tip with the leading slash.

In case others stumble upon this issue: I should have read on to chapter 13.4.1 in the book, where the respective routes are given :)

from asp-dot-net-core-in-action-3e.

Related Issues (1)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.