Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

101
Views
RoutePrefixAttribute in ASP.NET 5

I've started a new Web API 2.0 project in ASP.NET 5. I try to create custom RoutePrefixAttribute class but I get this error

The type or namespace name 'RoutePrefixAttribute' could not be found 
(are you missing a using directive or an assembly reference?)   {ProjectName}.DNX Core 5.0

Should I use some other class instead?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

There is indeed no RoutePrefixAttribute in MVC 6. Applying a [Route] attribute on a controller will now act as a route prefix:

[Route("api/[controller]/[action]")]
public class ProductsController : Controller
{
    [Route("{id:int}")]
    public JsonResult Details(int id)
    {
        // ...
    }
}

This will match api/Products/Details/42.

Also see this blogpost by Filip W.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!