Josh Close
Josh Close

Reputation: 23393

ASP.NET MVC Route Key Words

What are all the available routing key words?

I've seen examples using resource, pathInfo, url, controller, action, etc, but I have no clue what is available for me to use.

I know if you just put an arbitrary word like "{blah}" in there, you are defining a parameter that will be used, but I'm guessing you won't be able to use "{resource}" as a parameter name.

Upvotes: 1

Views: 1480

Answers (1)

Levi
Levi

Reputation: 32818

{controller} and {action} are the only two that are reserved in MVC v1. MVC v2 may additionally reserve {area}, but the details on that are still being fleshed out. When I say "reserved", I mean that MVC gives special meaning to them, but from a Routing perspective they're all keywords just the same and are not terribly special.

If you want, you can take controller, action, or any other reserved keyword in as a parameter to your action method. They're treated just like any other parameter.

Upvotes: 1

Related Questions