RobertKaucher Robert​Kaucher

Niner since 2012


  • Dan Roth Takes Us on a Deep Dive into Web API

    @John Farrar:

    There were some typos in my message above...

    In WebApiConfig.cs configure a new route to create a route where the map looks like this:

                    name: "FAQ",
                    routeTemplate: "api/faq/{controller}/{id}",
                    defaults: new { id = RouteParameter.Optional }

    I then added a new folder in the Controllers folder called faq. Then added my WebApiController called QuestionsController in the default namespace (MvcApplication1.Controllers.faq) and accessed it via http://localhost:61604/api/faq/Questions and I got my string values. I placed the route above the default route.