ASP.NET MVC - Removing controller name from URL -


i want remove controller name url (for 1 specific controller). example:

http://mydomain.com/mycontroller/myaction

i want url changed to:

http://mydomain.com/myaction

how go doing in mvc? using mvc2 if helps me in anyway.

you should map new route in global.asax (add before default one), example:

routes.maproute("specificroute", "{action}/{id}", new {controller = "mycontroller", action = "index", id = urlparameter.optional});  // default route routes.maproute("default", "{controller}/{action}/{id}", new {controller = "home", action = "index", id = urlparameter.optional} ); 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -