c# - shorten URL with routing? -


possible shorten url in routing mvc?

//fieldcontroller public actionresult field()  //views field 

so url ...field/field

is possible shorten/remove end field. ...field

is registerroutes in global

eg:     routes.maproute(         "default", // route name         "{controller}/{action}/{id}", // url parameters         new { controller = "public", action = "index", id = urlparameter.optional } // parameter defaults        ); 

yes. add new, explicit route above controller route.

routes.maproute("fieldroute", "field", new { controller = "fieldcontroller", action = "field" });


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -