Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7986203
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:47:15+00:00 2026-06-04T11:47:15+00:00

I installed the new ASP .Net MVC4 beta on my machine and have been

  • 0

I installed the new ASP .Net MVC4 beta on my machine and have been trying to understand how the Web API works. I built a demo for a single collection (ex. books). I followed the example on the asp.net website. I implemented my own methods for posting to a collections i.e. adding a new book, getting all books, getting a particular book, updating a book and deleting a book record. All this works fine.

Ex:

POST /books - adds a new book
GET /books - gets all books
GET /books/1 - get a particular book
PUT /books/1 - update a particular book
DELETE /books/1 - delete a particular book

Now I want to add another collection inside the books collection, say authors and want to implement the same POST, PUT, GET and DELETE calls for the new collection

I want the new calls to be something like this:

POST /books/1/authors - add a new author to a book
GET /books/1/authors - gets all authors of a book
GET /books/1/authors/a@a.com - get a particular author for a book
PUT /books/1/authors/a@a.com - update a particular author for a book
DLETE /books/1/authors/a@a.com - delete a particular author for a book

I am confused how to add a route to make this call work. By default I get this route with the project.

routes.MapHttpRoute(
name: "DefaultApi", 
routeTemplate: "api/{controller}/{id}", 
defaults: new { id = RouteParameter.Optional }
);

What is the right way to handle routes in this pattern for collections and associations between them?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T11:47:18+00:00Added an answer on June 4, 2026 at 11:47 am

    Managing routes in Global can be confusing and error prone. Personally, I found the Attribute Routing package helps simplify routing configuration greatly. This article explains how to acquire and use it.

    http://www.strathweb.com/2012/05/attribute-based-routing-in-asp-net-web-api/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi guys i am new to Sitecore and asp.net and iis. I have installed
I have installed an ASP.NET 4.0 Web forms application in IIS 7.5. If I
I have built my new website in Visual Studio 2010 (C# - ASP.NET 4).
I have installed NHibernate for my ASP.NET web app although I'm getting a problem
I have installed MVC 3 and now I'm trying to follow these steps: http://www.asp.net/mvc/tutorials/mvc-music-store/mvc-music-store-part-1
I have installed ASP.NET 4 using the Web Platform installer of a Windows 2008
having a problem with a new ASP NET app and ASPNETDB Installed on existing
I'm planning a new ASP.NET project that will become a product that is installed
I Installed Microsoft's Asp.net MVC 2 using the Web PI (on Windows XP) but
I'm working on a web site where the new pages are ASP.NET and the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.