asp.net mvc 3 - MVC3 MapRoute, how to -


I'm looking at creating some new routes in my MVC3 application. What I need is a path that will allow me to produce:

  {clientname} / {controller} / {action} / {id}   

Where am I unsure whether I should use the object default parameter

You can add the route definition to the following:

  route. MapRoute ("ClientRoute", "{clientname} / {controller} / {action} / {id}", new {controller = "home", verb = "index", id = UrlParameter.Optional});   

Because customer name is in the beginning, this is a mandatory value. It should always be specified and can not be empty.

For example, if you generate an anchor:

  @ html.ActionLink ("link text", "foo", new {clientname = "bar"} )   

This will produce the following output:

  & lt; A href = "/ bar / home / foo" & gt; Link text & lt; / A & gt;    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -