|
ASP.NET MVC Wildcard Routes
I have been having a great time playing with the new MVC Preview 2 bits released on www.asp.net.
I am working on a project however where I needed a url like:
/home/view/2008/spring/easter/morning
and I wanted to put in a route like:
{controller}/{action}/{id}
and I wanted id to get
“2008/spring/easter/morning”
This could be N levels deep so
{controller}/{action}/{id1}/{id2}/{id3}
is not a great solution.
After spelunking around on the www.asp.net forums I found I could do a route like:
{controller}/{action}/{*id}
This directs everything after the action to the id. Works great!
WideOpen Web
Wednesday, March 12, 2008 2:27:34 PM (Pacific Standard Time, UTC-08:00)
|