0

I'm working on a project using MVC-5. when i run my application, I'm getting this URL: http://192.169.235.120/home/home , but i want it to be like this: http://192.169.235.120/home

so is this possible in MVC-5

ashish
  • 25
  • 7

2 Answers2

2

You could either change the route as stated in Ahmad's answer or rename your action to Index. MVC automatically routes to http://{host}/ControllerName/ActionName; in your case this seems to be the action "Home" on controller "Home". Rename your action "Home" to "Index" and you'll be able to acces http://{host}/Home, don't forget to rename your view as well.

vistuu
  • 21
  • 2
0

You should map new route in the Global.asax or RouteConfig.cs if you're using MVC 4, (add it before the default one), for 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} );

Hope this is helpful :)

Ahmad
  • 445
  • 5
  • 15