tags:

views:

16

answers:

1

Hi,

I have this url working in my code:

http://localhost:12345/home/index/<parameter1>/<parameter2>/<parameter3>/<parameter4>

I want to change my url to NOT to include the home/index (<controller>/<action>).

My current Global.asax entry is like:

 routes.MapRoute(
   "Default", // Route name
   "{controller}/{action}/{parameter1}/{parameter2}/{parameter3}/{year}/{parameter4}", // URL with parameters
   new { controller = "Home", action = "Index", parameter1= "", parameter2= "", parameter3= "", parameter4= ""} // Parameter defaults
   );

Please let me know how can i change it thanks in advance

A: 

Should be as simple as removing those parameters from the URL since you have them in the Defaults dictionary.

routes.MapRoute( "Default", // Route name "{parameter1}/{parameter2}/{parameter3}/{year}/{parameter4}", // URL with parameters new { controller = "Home", action = "Index", parameter1= "", parameter2= "", parameter3= "", parameter4= ""} // Parameter defaults );

Haacked