You're developing a web application where you want to set up pages for different categories. The URL should look like /categoryName. How would you define the routing for this requirement?
- Use attribute routing
- Configure a conventional route
- Use a query string
- Define a wildcard route
To achieve URLs like /categoryName in ASP.NET Core, you can configure a conventional route. This involves setting up a route template in your application's startup, which specifies the desired URL structure and how it maps to controller actions.
Loading...
Related Quiz
- The _______ directive in _ViewImports.cshtml is used to include a namespace across multiple Razor views.
- You are creating a website and want to add a folder for storing images, scripts, and CSS files. Which default folder in ASP.NET Core would you typically use?
- For a Web API, you're required to ensure that only authenticated users can access specific endpoints, but some endpoints should be public. How would you achieve this in ASP.NET Core?
- What is the primary purpose of the Register action in a typical ASP.NET Core Identity controller?
- In complex scenarios, instead of using simple roles or claims, you might need a custom authorization policy. How do you apply a custom policy using the [Authorize] attribute?