asp.net mvc - MVC3 maproute where first value of URL is querstring for default controller and action -



asp.net mvc - MVC3 maproute where first value of URL is querstring for default controller and action -

i want create route this:

routes.maproute( "default", // route name "{s}", // url parameters new { controller = "home", action = "index", s = urlparameter.optional } );

where s parameter default controller , action.. possible? settle like:

routes.maproute( "default", // route name "{controller}/{action}/{s}", // url parameters new { controller = "home", action = "index", s = urlparameter.optional } ); routes.maproute( "qmap", // route name "sc/{s}", // url parameters new { controller = "home", action = "index", s = urlparameter.optional } );

but neither work.. suspect because first element/paramater expected controller?

if have next route definition (make sure have removed other route definitions registerroutes method):

routes.maproute( "default", "{s}", new { controller = "home", action = "index", s = urlparameter.optional } );

and next controller:

public class homecontroller: controller { public actionresult index(string s) { ... } }

a request of form http://foo.com/abc routed home controller , index action invoked , passed s=abc.

asp.net-mvc asp.net-mvc-3 routing asp.net-mvc-routing

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -