0

I need url for editing friends in my ASP.NET MVC site like this:

site.com/friend{x}/edit 

where {x} - id of friend.

So, how should I use my ActionLinks, Controller name and Routings ?

1 Answer 1

2

Assuming your control is called FriendController, try adding a custom route such as:

routes.MapRoute(
  "Friends", // Route name
  "friend{id}/{action}", // URL with parameters
  new { controller = "Friend", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);

Then you would construct your ActionLinks, etc. exactly as normal.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.