0

I'm trying to create a route that looks like this

site.com/controller/{Param1}/{dbID}-{friendly-name}

and omit the default action index , and for the action edit to be at the end of the url like so

site.com/controller/{Param1}/{dbID}-{friendly-name}/edit

routes are a bit confusing for me , so any help is appreciated , Thanks!

asked Jul 13, 2010 at 11:31

1 Answer 1

1

You could try like this:

routes.MapRoute(
 "SomeRoute",
 "{controller}/{param1}/{dbID}-{friendlyName}/{action}",
 new 
 { 
 controller = "home", 
 action = "index",
 param1 = "CANNOT BE OPTIONAL",
 dbID = "SOME DEFAULT ID",
 friendlyName = "SOME DEFAULT FRIENDLY NAME"
 }
);
answered Jul 13, 2010 at 11:35
Sign up to request clarification or add additional context in comments.

2 Comments

hm , if i request the page without the index action at the end , it doesn't load :(
its also important to put the default route at the bottom and the more specific routes at the top :)

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.